pax_global_header00006660000000000000000000000064152640473240014521gustar00rootroot0000000000000052 comment=621fa9e8c43fafca8a0f299ac116715b3a835fbe libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/000077500000000000000000000000001526404732400222145ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/.gitignore000066400000000000000000000000101526404732400241730ustar00rootroot00000000000000/build/ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/LICENSES/000077500000000000000000000000001526404732400234215ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/LICENSES/LGPL-3.0-or-later.txt000066400000000000000000000164071526404732400267510ustar00rootroot00000000000000GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/NEWS000066400000000000000000000422741526404732400227240ustar00rootroot00000000000000News in 6.15.0, 2026-10-15 -------------------------- * TeplCodeCommentView: fine tune the behavior. * Don't annotate get_type() functions with G_GNUC_CONST. * Translations updates. News in 6.14.0, 2026-01-03 -------------------------- * Nothing new. News in 6.14.alpha2, 2025-11-17 ------------------------------- * New class: TeplStatusbar. * Translations updates. News in 6.14.alpha1, 2025-09-05 ------------------------------- * Add TeplCodeCommentView for the comment/uncomment feature. * Remove tepl_iter_*() function, moved to libgedit-gtksourceview. * TeplFileLoader: use libgedit-gfls. * Translations updates. News in 6.13.0, 2025-03-08 -------------------------- * New and removed API: see the API reference. * Translation updates. News in 6.12.0, 2024-12-07 -------------------------- * New and removed API: see the API reference. * Fix compilation warnings. * Translation updates. News in 6.11.0, 2024-08-31 (stable version) ------------------------------------------- New versioning scheme: - Adopt the x.y.alpha, x.y.beta and x.y.rc versions for pre-releases. For example: 6.11.beta (pre-release), 6.11.0 (stable version). New features: - Full support for light/dark GTK theme variants. - Side and bottom panels support: rework the API. Bug fixes: - TeplTabLabel: correct position for the close button. For packagers: - Build: add the 'tests' option. Misc: - Documentation improvements. News in 6.10.0, 2024-04-27 (stable version) ------------------------------------------- * Rename the project from Tepl to libgedit-tepl. * The project is now hosted here: https://gedit-technology.github.io/ https://github.com/gedit-technology/libgedit-tepl * libgedit-gfls is used as a new dependency. * New APIs: see the API docs. News in 6.9.0, 2024-02-16 ------------------------- * libhandy-1 is used as a new dependency (for dark style preference handling). * Replace _TEPL_EXTERN custom macro by G_MODULE_EXPORT. * New APIs: see the API docs. News in 6.8.0, 2023-07-29 ------------------------- * Update for Amtk -> libgedit-amtk rename. * New/changed/removed APIs: see the API docs. * A bug fix. News in 6.6.0, 2023-06-29 ------------------------- * Nothing transcendental. News in 6.5.1, 2023-04-26 ------------------------- * Tepl now depends on libgedit-gtksourceview instead of GtkSourceView: https://github.com/gedit-technology/libgedit-gtksourceview https://gedit-technology.net/ * New classes: TeplStack, TeplStackItem and TeplStackSwitcherMenu. * Remove the attic/ (no longer necessary with the TeplStack* classes). * Build: adapt to the latest Meson version. News in 6.4.0, 2023-01-01 ------------------------- * Build: simplify handling of library soversion. * Add some new API (see the reference documentation). * Some API breaks (see the reference documentation). * Experiments to simplify GtkStack custom switcher implementations. Moved the result to the attic/ directory. * TeplView: add code from gedit: override delete_from_cursor vfunc. In gedit it's for the Ctrl+D keybinding to delete the current line. News in 6.2.0, 2022-11-02 ------------------------- * Remove deprecated API. * Add some new API (see the reference documentation). * Small improvements. News in 6.1.2, 2022-07-12 ------------------------- * API stability is no longer guaranteed. * New features / API: see the index of new symbols in the reference documentation (generated with gtk-doc). * Documentation improvements. News in 6.1.1, 2022-06-10 ------------------------- * New features / API: see the index of new symbols in the reference documentation (generated with gtk-doc). * Tests: files reorganization within the repository, have the following directories: - tests/interactive-tests/ - tests/unit-tests/ * Documentation: split the API Reference into two parts: - Text Editor Support - General Utilities (more broadly applicable) * Documentation: various other small improvements. News in 6.0.2, 2022-05-27 ------------------------- * Build system: check if compiler supports --version-script linker option. News in 6.0.1, 2022-05-02 ------------------------- * No changes. * Note that a 6.00.0 version was released in 2021. The double 00 was a mistake. See https://download.gnome.org/sources/tepl/6.00/ Hence the .1 micro version number in this release. News in 5.99.1, 2022-04-21 -------------------------- * The project is now located at: https://gitlab.gnome.org/swilmet/tepl * API changes: - The TeplInfoBar class has been reworked. * New API: - tepl_pango_font_description_to_css() - TeplLanguageChooser - TeplLanguageChooserWidget - TeplLanguageChooserDialog - TeplProgressInfoBar - TeplSignalGroup (make the class public). - Utility functions: add a few functions. * Misc: - Build: add a gobject_introspection option. - tepl_utils_replace_home_dir_with_tilde(): support $HOME that ends with a slash. - Documentation improvements. - Translation updates. News in 5.1.1, 2020-10-11 ------------------------- * Add TeplSpaceDrawerPrefs, a preferences widget for GtkSourceSpaceDrawer. * Translation updates. News in 5.0.0, 2020-09-11 ------------------------- * Translation updates. News in 4.99.4, 2020-09-04 -------------------------- * Add a few extra functions for GtkFileChooser. * Translation updates. News in 4.99.3, 2020-07-03 -------------------------- * Start to leverage the ICU library: http://site.icu-project.org/ It's currently used by TeplMetadataManager. News in 4.99.2, 2020-05-29 -------------------------- * License: - Update the license from LGPLv2.1+ to LGPLv3+. - Start to use the REUSE way of applying licenses and copyrights information, with SPDX tags: https://reuse.software/ * API changes: - The beginning of a complete overhaul of the file loading and saving. This changes a little the API. The uchardet dependency is no longer needed. * New API: - 'Go to line' horizontal bar feature. - Utility functions: add a function. * Under the hood changes: - Have _TEPL_EXTERN macro for exporting public symbols. - Have a smaller TeplApplicationWindow class, factor out several tepl-window-actions-*.{c,h} files. * Misc: - Improvements to the build system. - Metadata: improve the implementation and write unit tests. - Init i18n. - Tools: add shared-mime-info-list-text-plain-globs. - Translation updates. News in 4.99.1, 2020-04-24 -------------------------- * Build system: port to Meson, remove Autotools. * API changes: - A complete overhaul of the metadata API and implementation. The libxml2 is no longer required, and GVfs metadata is no longer used. New API: - TeplMetadata and TeplMetadataManager toolkit classes. - Convenience functions in the framework, in TeplAbstractFactory, TeplApplication and TeplBuffer. - Remove TeplAbstractFactoryVala, because it's possible to manually manage GObject references in Vala when using TeplAbstractFactory. * New API: - New class: TeplStatusbar. - New class: TeplPanel. - New class: TeplStyleSchemeChooserWidget. - File loading and saving toolkit: start to add some IO error info bars. - TeplInfoBar: add tepl_info_bar_set_buttons_orientation(). - TeplView: add tepl_view_new_with_buffer(). - Utility functions: add more functions. * Misc: - Write a new roadmap in docs/. - Translation updates. News in 4.4.0, 2020-03-05 ------------------------- * Translation updates. News in 4.3.1, 2019-11-22 ------------------------- * Utils functions: make some functions public, add more public functions, and write more unit tests. * Documentation: introduction: more information about the chosen development model. * Translation updates. News in 4.2.1, 2019-11-21 ------------------------- Changes for packagers: * Documentation: GTK+ -> GTK. Please update the description of the package. Other changes: * Fix a few compilation warnings. * Better use of errno (save its value ASAP, then reset it to 0). * Build from Git: - Allow building with gettext ≥ 0.20. - Adapt for AX_CODE_COVERAGE API break in autoconf-archive version 2019.01.06. (this didn't affect the build from the previous tarball, since the Autotools are "bundled" with the tarball). * Translation updates. News in 4.2.0, 2018-07-16 ------------------------- * Nothing new. News in 4.1.1, 2018-04-15 ------------------------- * Remove the Amtk library, it has been moved to its own git repository, see: https://wiki.gnome.org/Projects/Amtk News in 4.0.0, 2018-04-08 ------------------------- - Project moved to GNOME GitLab. - Various small improvements. - Translation updates. News in 3.99.1, 2017-12-09 -------------------------- * General: - Use GtkSourceView 4. * Amtk: - Improve amtk_utils_bind_g_action_to_gtk_action() to support _detailed_ GAction names. - Add amtk_utils_create_gtk_action(). * Framework: - Add more GAction's and corresponding AmtkActionInfo's: - win.tepl-undo - win.tepl-redo - win.tepl-indent - win.tepl-unindent - win.tepl-open - win.tepl-save - win.tepl-save-as - app.tepl-new-window - Add TeplApplicationWindow:handle-title boolean property to handle the window title. - Add more vfuncs to TeplAbstractFactory: create_file and create_main_window. - Add TeplAbstractFactoryVala class to work-around Vala bugs. - Add functions related to main windows: - tepl_application_get_active_main_window() - tepl_application_window_is_main_window() - tepl_application_window_get_window_group() - TeplApplication: add options to handle the GApplication::activate and GApplication::open signals. - Start to write high-level functions for loading and saving files. - On Tab::close-request, show close confirmation dialog. * File loading and saving toolkit: - TeplFileLoader: - Internal code refactorings to have more re-usable code independent of GtkTextView. - Add fallback mode to determine encoding if uchardet fails. - Write more unit tests. - TeplEncoding: - Make tepl_encoding_get_default_candidates() more robust in case of mis-translation. - Improve API documentation. - Write GtkSourceView to Tepl file loading and saving porting guide. * Misc: - Translation updates. News in 3.0.0, 2017-09-09 ------------------------- * Translation updates. News in 2.99.4, 2017-08-20 -------------------------- Amtk: * Add factory functions to create GtkMenuToolButton's and GtkCheckMenuItem's. * Improve API of amtk_application_window_connect_menu_to_statusbar(). * Add amtk_utils_bind_g_action_to_gtk_action(), to be able to port an application gradually to GAction while still using GtkUIManager. Framework: * TeplTabLabel: add an overridable tooltip API, by default the tooltip shows the file location. News in 2.99.3, 2017-08-09 -------------------------- Amtk: * Add amtk_init() and amtk_finalize(). * Remove AmtkFactoryMenu class, move its functions to its parent class AmtkFactory. * AmtkFactory: add functions to create GtkToolItem's. * Add amtk_application_window_create_open_recent_menu(). * Improvements to the documentation. * Other small code improvements. Framework: * TeplTabGroup interface: * Add :active-tab, :active-view and :active-buffer properties. * Add tepl_tab_group_set_active_tab(). * Add tepl_tab_group_append_tab(). * Finish to implement the GActions for the Edit menu: cut, copy, paste, delete and select all. (Update the GAction:enabled properties). * Add "win.tepl-new-file" GAction. * Add the TeplAbstractFactory class to create TeplTab's and tab labels. * TeplBuffer: rename title -> full-title and add short-title. * Add the TeplTab::close-request signal. * Add the TeplTabLabel class (which shows the buffer short-title, plus a close button; the tooltip is not yet handled). Misc: * Add tepl_init() and tepl_finalize(), do not use DSO constructors/destructors. * Implement small internal utility: TeplSignalGroup, inspired by DzlSignalGroup from libdazzle, but with a much simpler implementation. * Improvements to the documentation. * Translation updates. News in 2.99.2, 2017-07-18 -------------------------- Amtk: * The biggest change in this release is that the classes and functions related to actions and menus have been moved to a new shared library called Amtk (Actions, Menus and Toolbars Kit), since it was not really related to text editors, it is more general. But Amtk is still developed inside the Tepl repository. Amtk is a basic GtkUIManager replacement based on GAction (still under development, it is not yet finished, for example it doesn't handle toolbars). * Add AmtkFactory and AmtkFactoryMenu, which replace amtk_action_info_store_create_menu_item(). Framework: * Revamp TeplTab. * Add TeplTabGroup interface. * Add TeplNotebook that implements TeplTabGroup. * Implement TeplTabGroup in TeplTab and TeplApplicationWindow. * Start to implement the Edit menu: provide GActions and AmtkActionInfos for the cut, copy, paste, delete and select all actions. Misc: * Improve TeplInfoBar. News in 2.99.1, 2017-06-15 -------------------------- * The library has been renamed from Gtef (GTK+ text editor framework) to Tepl (Text editor product line), to have a more beautiful name. The end of Tepl is pronounced like “apple”. * Write a more complete introduction in the reference manual. * Add Slovenian translation. News in 2.0.1, 2017-04-21 ------------------------- * The bugzilla product has been created. * Fix bug in gtef_iter_get_line_indentation(). * Add Hungarian, Russian and Friulian translations. * Other small improvements. News in 2.0.0, 2017-03-18 ------------------------- * Add Ukrainian and Serbian translations. News in 1.99.2, 2017-03-12 -------------------------- This is an unstable release leading towards 2.0. The 2.0 stable version will be released at the same time as GNOME 3.24. Basic GtkUIManager replacement based on GAction: * Add an easy way to create a GtkMenuItem from a GtefActionInfo. * Add a function to check that every GtefActionInfo in a GtefActionInfoStore has been used. * Add reference counting to GtefActionInfo. * Add GtefActionInfoCentralStore singleton class. * Add gtef_action_map_add_action_entries_check_dups(), to check if there are duplicates when adding GActions to a GActionMap. * Rename gtef_application_get_action_info_store() to gtef_application_get_app_action_info_store(). * Add GtefMenuShell, an extension of GtkMenuShell with the ::menu-item-selected and ::menu-item-deselected signals. * Add gtef_menu_item_get/set_long_description(). * Add GtefApplicationWindow, an extension of GtkApplicationWindow with: * A statusbar property. * A function to connect a GtefMenuShell to the statusbar, pushing/popping the long descriptions of GtkMenuItems when they are selected/deselected. * A function to connect a GtkRecentChooserMenu to the statusbar, pushing/popping the full paths. * A function to create a GtkMenuItem with a simple and generic GtkRecentChooserMenu as submenu. Misc: * Add gtef_application_open_simple(). * Replace GNOME by GTK+ in the Gtef acronym. Gtef now stands for “GTK+ Text Editor Framework”. * The project is now hosted on gnome.org! https://wiki.gnome.org/Projects/Gtef The bugzilla product is not yet created. * Add Polish, Brazilian Portuguese, Swedish, Indonesian and German translations. News in 1.99.1, 2017-01-26 -------------------------- This is an unstable release leading towards 2.0. The 2.0 stable version will be released at the same time as GNOME 3.24. File loading and saving: * Finish the first usable version of the new GtefFileLoader. * Use etags instead of mtime. * GtefFileSaver: do not use an heuristic to know if it's a "save as" operation. * Add GtefEncoding, a fork of GtkSourceEncoding to suit the needs of the new file loader. * Re-usable code outside of GtkTextView: GtefFileContentLoader and GtefEncodingConverter (private classes). * Various other small improvements. Various features for text editors: * Add GtefBuffer:gtef-style-scheme-id property. * Add gtef_view_select_lines(). * Add gtef_view_goto_line() and gtef_view_goto_line_offset(). * Add gtef_iter_get_line_indentation(). * The GtefInfoBar class has been revamped. Starting a basic GtkUIManager replacement based on GAction: * Add gtef_utils_menu_item_set_icon_name() * Add GtefActionInfo * Add GtefActionInfoStore * Note that those classes are a little out of scope for a text editor library. I would be happy to move those classes to a better library once the feature is finished and well-tested. The classes were added to Gtef for convenience. Framework: * Add gtef namespace to GtefBuffer signals and properties to avoid potential conflicts with future GtkSourceView versions. * Add GtefApplication with gtef_application_get_action_info_store(). Documentation: * Add an intro with the pkg-config name. * List API breaks. Misc: * Improvements to the build system. News in 1.0.0, 2016-10-26 ------------------------- This is the first version of Gtef. File loading and saving: * Save and load file metadata. If GVfs is not available, there is a fallback implementation with an XML file (used e.g. on Windows). * A new file loader based on uchardet (implementation not completely finished). Starting the framework: * GtefBuffer, a subclass of GtkSourceBuffer with additional features. * GtefView, a subclass of GtkSourceView with additional features. * GtefTab, contains a GtefView with GtkInfoBars on top. * GtefInfoBar, a subclass of GtkInfoBar. Starting code folding: * GtefGutterRendererFolds, a basic gutter renderer for code folding. * GtefFoldRegion, a foldable region in a GtkTextBuffer. libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/README.md000066400000000000000000000006531526404732400234770ustar00rootroot00000000000000libgedit-tepl ============= Short description ----------------- Gedit Technology - Text editor product line Longer description ------------------ libgedit-tepl is part of [Gedit Technology](https://gedit-text-editor.org/technology.html). It is a library that eases the development of text editors and IDEs based on GTK. More information ---------------- [More information about libgedit-tepl](docs/more-information.md). libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/build/000077500000000000000000000000001526404732400233135ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/build/.gitignore000066400000000000000000000000021526404732400252730ustar00rootroot00000000000000* libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/000077500000000000000000000000001526404732400231445ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/more-information.md000066400000000000000000000020721526404732400267540ustar00rootroot00000000000000libgedit-tepl - more information ================================ Renames ------- - The first name was “Gtef” (GTK text editor framework). - In June 2017 the project has been renamed to “Tepl” to have a more beautiful name. - In April 2024 the project has been renamed to “libgedit-tepl”. Dependencies ------------ - GTK 3 - [ICU](https://icu.unicode.org/) - gsettings-desktop-schemas - libhandy From [Gedit Technology](https://gedit-text-editor.org/technology.html): - libgedit-amtk - libgedit-gfls - libgedit-gtksourceview Documentation ------------- See the `gtk_doc` Meson option. A convenient way to read the API documentation is with the [Devhelp](https://gitlab.gnome.org/swilmet/devhelp) application. See also other files in this directory for additional notes. Releases -------- Versions are now released simply by creating **Git tags**. - [Old libgedit-tepl tarballs](https://download.gnome.org/sources/libgedit-tepl/) - [Old Tepl tarballs](https://download.gnome.org/sources/tepl/) - [Old Gtef tarballs](https://download.gnome.org/sources/gtef/) libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/000077500000000000000000000000001526404732400251025ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/api-breaks.xml000066400000000000000000000344451526404732400276540ustar00rootroot00000000000000 %gtkdocentities; ]> API Breaks Gtef 1 -> Gtef 2 The GtefBuffer::cursor-moved signal has been renamed to GtefBuffer::gtef-cursor-moved. The GtefBuffer:title property has been renamed to GtefBuffer:gtef-title. Gtef 2 -> Tepl 3 The library has been renamed to Tepl (Text editor product line). So the namespace of the code has changed. The new version is Tepl 3 and not Tepl 1, to avoid confusion with the git tags (the git repository is still the same), since the repository already contains tags for versions 1 and 2. The TeplTab class has been revamped. The tepl_tab_new() function doesn't take a GtkWidget parameter anymore, a TeplView is created instead. The TeplBuffer:tepl-title property has been renamed to TeplBuffer:tepl-full-title, and tepl_buffer_get_title() has been renamed to tepl_buffer_get_full_title(). Gtef 2 -> Amtk 3 The classes and functions related to actions and menus have been moved to a new shared library called Amtk (Actions, Menus and Toolbars Kit), since it was not really related to text editors, it is more general. But Amtk is still developed inside the Tepl repository. The AmtkFactory class has been added, which replace gtef_action_info_store_create_menu_item() and removes the GtefActionInfoStore:application property. gtef_action_info_central_store_get_instance() has been renamed to amtk_action_info_central_store_get_singleton(). amtk_application_window_connect_menu_to_statusbar() now takes a GtkMenuShell parameter instead of AmtkMenuShell. Tepl 3 -> Tepl 4 Tepl 3 depended on GtkSourceView 3, Tepl 4 depends on GtkSourceView 4. So to be able to use Tepl 4, you need to port your code to GtkSourceView 4. Note that the GTK dependency is still GTK 3. The TeplTab::close-request signal has now a default object method handler. Tepl 4 -> Tepl 5 The TeplEncoding class has been removed, as part of the beginning of a complete overhaul of the file loading and saving functionality. Start to rework the TeplFile, TeplFileLoader and TeplFileSaver classes. As such, there are some API breaks in those classes. And as a result, they currently contain less features as before, unfortunately. The TeplMetadataManager API has been re-worked. The TeplFileMetadata class has been replaced by TeplMetadata, the latter no longer depends on TeplFile. The tepl_file_get_file_metadata() function has been removed. The tepl_tab_load_file() function no longer loads the file metadata (but it was anyway an implementation detail). The TeplAbstractFactoryVala class has been removed, because it's possible to manually manage GObject references in Vala. Tepl 5 -> Tepl 6 The tepl_info_bar_set_buttons_orientation() now takes a GtkInfoBar parameter, not a TeplInfoBar. The tepl_info_bar_add_close_button() function has been renamed to tepl_info_bar_setup_close_button(). The tepl_info_bar_add_icon() function has been replaced by tepl_info_bar_set_icon_from_message_type(). A location parameter has been added to the tepl_info_bar_add_content_widget() function. API breaks during Tepl 6 There are also ABI breaks not affecting the API, so just re-compiling the program is sufficient in that case. Tepl 6.0 to Tepl 6.2: The tepl_utils_override_font() function has been renamed to tepl_utils_override_font_string(). Tepl 6.2 to Tepl 6.4: The tepl_statusbar_*() functions have been removed, you can use TeplLineColumnIndicator instead. Tepl 6.4 to Tepl 6.6: Tepl now depends on libgedit-gtksourceview instead of GtkSourceView. The TeplWidgetListItem and TeplWidgetListCategory classes have been removed. Tepl 6.6 to Tepl 6.8: The TeplPanel class has been renamed to TeplPanel1. The TeplStack, TeplStackItem and TeplStackSwitcherMenu classes have been removed. They are superseded by TeplPanel (and related classes and interfaces). The TeplStatusbar class has been removed, and is replaced by tepl_utils_setup_statusbar(). Tepl 6.8 to libgedit-tepl 6.10: Tepl has been renamed to libgedit-tepl. The new pkg-config name is: libgedit-tepl-6 TeplFile now uses GflsUnsavedDocumentTitles. This affects the TeplFile:short-name property. Also, tepl_file_set_untitled_file_callback() and TeplUntitledFileCallback have been removed. libgedit-tepl 6.10 to 6.11: The TeplSettingsSimpleThemeVariant enum, tepl_settings_handle_simple_theme_variant() and tepl_prefs_create_simple_theme_variant_combo_box() have been removed. You can use instead the more complete TeplSettingsThemeVariant enum and the functions that use it. tepl_buffer_provide_style_scheme_id_gsetting() has been removed. Use TeplSettings instead to provide two GSettings keys instead of one. The TeplBuffer:tepl-style-scheme-id property, tepl_buffer_get_style_scheme_id() and tepl_buffer_set_style_scheme_id() have been removed. You can use tepl_buffer_connect_style_scheme_settings() instead. tepl_prefs_create_color_scheme_component() and the TeplStyleSchemeChooserWidget class have been removed. They are replaced by TeplStyleSchemeChooserSimple and TeplStyleSchemeChooserFull. TeplTabLabel now inherits from GtkBox instead of GtkGrid. TeplPanelItem is now a GObject class instead of an interface. The API of tepl_panel_add() and its vfunc have changed. The API of TeplPanelSwitcherMenu has changed. The TeplPanelSwitcherNotebook class has been removed, you can use TeplPanelNotebook instead. The TeplPanelContainer class has been removed, you can use TeplPanelSimple instead. libgedit-tepl 6.11 to 6.12: The tepl_prefs_create_display_grid_checkbutton() function has been removed. libgedit-tepl 6.12 to 6.13: The tepl_abstract_factory_fill_prefs_dialog() function and its vfunc have been replaced by tepl_abstract_factory_create_prefs_dialog(). The TeplEncoding interface and the TeplEncodingIconv class have been removed. libgedit-tepl 6.13 to 6.14: The tepl_iter_get_line_indentation() function has been moved to libgedit-gtksourceview as gtk_source_iter_get_line_indentation(). libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/intro.xml000066400000000000000000000126311526404732400267620ustar00rootroot00000000000000 %gtkdocentities; ]> Introduction libgedit-tepl is a library that eases the development of text editors and IDEs based on GTK. Tepl is the acronym for “Text editor product line”. The libgedit-tepl library follows a product line approach, inspired by Feature-Oriented Software Product Lines: Concepts and Implementation (2013 - Apel, Batory, Kästner and Saake). Instead of creating one general-purpose text editor or IDE with a plugin system, the idea is to create several specialized text editors. For example specialized for one programming language, or one development platform, or a small group of related languages. By being specialized, an application is potentially better at what it does. It follows more closely the UNIX philosophy to “do only one thing but do it well”. And it better follows the GNOME philosophy: writing applications that Just Works; when a user opens the text editor for the first time, it should work out-of-the-box, without the need to find, install and configure plugins. Of course it still makes sense to develop one general-purpose text editor for the languages not yet covered by specialized text editors. Most of the features of the library are available as a toolkit, but the interesting part of libgedit-tepl is that it contains also a framework (for now without a plugin system). The goal of the framework is to provide higher-level APIs, to be able to create a new text editor easily. An application wanting to use libgedit-tepl is not forced to use the framework in its entirety, it is possible to use just the toolkit parts. The library is implemented this way to achieve maximum re-usability: the framework is less re-usable because it makes some assumptions about the general architecture of the application, but since the features are also available with a lower-level API – as a toolkit – all text editors and IDEs based on GTK and libgedit-gtksourceview (or even other types of applications) should be able to benefit from the features implemented in libgedit-tepl. Initially, libgedit-tepl was created as an incubator for new GtkSourceView features, but in practice the features remained in libgedit-tepl, because libgedit-tepl is considered less stable for its APIs, and it's convenient to iterate on the APIs with more freedom. Another reason is that renaming the namespace of all symbols is difficult to do in C. Boundary between libgedit-gtksourceview and libgedit-tepl For the framework part of libgedit-tepl (not the toolkit parts), there is a somewhat clear boundary between libgedit-gtksourceview and libgedit-tepl: the top-level object in libgedit-gtksourceview is the GtkSourceView widget (representing only one view, or one file), while the GtkSourceView widget is at the bottom of the containment hierarchy in the libgedit-tepl framework (it is a “somewhat” clear boundary because there is also TeplBuffer, a subclass of GtkSourceBuffer). The top-level object in libgedit-tepl is TeplApplication, representing the whole application which can contain several windows, with each window containing one or several GtkSourceView widgets (typically with a Tabbed Document Interface). So the libgedit-gtksourceview library is not aware that there can be several files opened in the application, while the libgedit-tepl framework has a complete view of the application with regards to the opened files/tabs. It permits to implement higher-level APIs. API stability The API is now constantly unstable. The library soname is adapted (if needed) for each release. libgedit-tepl contains experimental APIs, sometimes even unfinished features. API design is hard, it needs an iterative process. Instead of being stuck for years with a non-optimal API, the libgedit-tepl developers want to be able to break the API at any time, to iteratively improve it. Sometimes we see possible improvements several years later. The API breaks are documented in this section. GTK dependency libgedit-tepl &package_api_version; depends on GTK 3. pkg-config name For libgedit-tepl &package_api_version;, the pkg-config name is: libgedit-tepl-&package_api_version; libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/libgedit-tepl-docs.xml000066400000000000000000000173371526404732400313120ustar00rootroot00000000000000 %gtkdocentities; ]> libgedit-tepl &package_api_version; Reference Manual For &package_string; API Reference - Text Editor Support General Framework Menus File Loading and Saving Code Folding Language Choosers Code Comment Misc API Reference - General Utilities GObject Extras GIO Extras - File Metadata GIO Extras - Other GTK Extras - Info Bars GTK Extras - Side or Bottom Panel GTK Extras - Other Other Extras Annexes Object Hierarchy Index of all symbols Index of deprecated symbols Index of new symbols in 1.0 Index of new symbols in 2.0 Index of new symbols in 3.0 Index of new symbols in 4.0 Index of new symbols in 4.4 Index of new symbols in 5.0 Index of new symbols in 6.0 Index of new symbols in 6.2 Index of new symbols in 6.4 Index of new symbols in 6.8 Index of new symbols in 6.10 Index of new symbols in 6.11 Index of new symbols in 6.12 Index of new symbols in 6.13 Index of new symbols in 6.14 libgedit-tepl-sections.txt000066400000000000000000000511161526404732400321420ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/referencetepl/tepl.h
init Tepl Initialization and Finalization tepl_init tepl_finalize TEPL_H_INSIDE
abstract-factory TeplAbstractFactory TeplAbstractFactoryClass tepl_abstract_factory_set_singleton tepl_abstract_factory_get_singleton tepl_abstract_factory_create_main_window tepl_abstract_factory_create_tab tepl_abstract_factory_create_tab_label tepl_abstract_factory_create_file tepl_abstract_factory_create_metadata_manager_file tepl_abstract_factory_create_prefs_dialog TEPL_ABSTRACT_FACTORY TEPL_ABSTRACT_FACTORY_CLASS TEPL_ABSTRACT_FACTORY_GET_CLASS TEPL_IS_ABSTRACT_FACTORY TEPL_IS_ABSTRACT_FACTORY_CLASS TEPL_TYPE_ABSTRACT_FACTORY tepl_abstract_factory_get_type
application TeplApplication tepl_application_get_from_gtk_application tepl_application_get_default tepl_application_get_application tepl_application_get_app_action_info_store tepl_application_get_tepl_action_info_store tepl_application_get_active_main_window tepl_application_open_simple tepl_application_handle_activate tepl_application_handle_open tepl_application_handle_metadata TEPL_APPLICATION TEPL_APPLICATION_CLASS TEPL_APPLICATION_GET_CLASS TEPL_IS_APPLICATION TEPL_IS_APPLICATION_CLASS TEPL_TYPE_APPLICATION TeplApplicationClass TeplApplicationPrivate tepl_application_get_type
application-window TeplApplicationWindow tepl_application_window_get_from_gtk_application_window tepl_application_window_get_application_window tepl_application_window_set_tab_group tepl_application_window_is_main_window tepl_application_window_get_window_group tepl_application_window_get_handle_title tepl_application_window_set_handle_title tepl_application_window_open_file TEPL_APPLICATION_WINDOW TEPL_APPLICATION_WINDOW_CLASS TEPL_APPLICATION_WINDOW_GET_CLASS TEPL_IS_APPLICATION_WINDOW TEPL_IS_APPLICATION_WINDOW_CLASS TEPL_TYPE_APPLICATION_WINDOW TeplApplicationWindowClass TeplApplicationWindowPrivate tepl_application_window_get_type
buffer TeplBuffer TeplSelectionType tepl_buffer_new tepl_buffer_get_file tepl_buffer_get_metadata tepl_buffer_load_metadata_from_metadata_manager tepl_buffer_save_metadata_into_metadata_manager tepl_buffer_is_untouched tepl_buffer_get_short_title tepl_buffer_get_full_title tepl_buffer_connect_style_scheme_settings tepl_buffer_get_selection_type TEPL_TYPE_BUFFER TeplBufferClass TEPL_TYPE_SELECTION_TYPE tepl_selection_type_get_type
code-comment-view TeplCodeCommentView tepl_code_comment_view_new tepl_code_comment_view_get_source_view tepl_code_comment_view_code_comment_is_supported tepl_code_comment_view_comment_lines tepl_code_comment_view_comment_selected_lines tepl_code_comment_view_uncomment_selection TEPL_CODE_COMMENT_VIEW TEPL_CODE_COMMENT_VIEW_CLASS TEPL_CODE_COMMENT_VIEW_GET_CLASS TEPL_IS_CODE_COMMENT_VIEW TEPL_IS_CODE_COMMENT_VIEW_CLASS TEPL_TYPE_CODE_COMMENT_VIEW TeplCodeCommentViewClass TeplCodeCommentViewPrivate tepl_code_comment_view_get_type
file TeplFile TeplNewlineType TEPL_NEWLINE_TYPE_DEFAULT TeplMountOperationFactory tepl_file_new tepl_file_get_location tepl_file_set_location tepl_file_get_short_name tepl_file_get_full_name tepl_file_get_newline_type tepl_file_set_mount_operation_factory tepl_file_add_uri_to_recent_manager TEPL_FILE TEPL_FILE_CLASS TEPL_FILE_GET_CLASS TEPL_IS_FILE TEPL_IS_FILE_CLASS TEPL_TYPE_FILE TEPL_TYPE_NEWLINE_TYPE TeplFileClass TeplFilePrivate tepl_file_get_type tepl_newline_type_get_type
file-chooser tepl_file_chooser_set_modal tepl_file_chooser_set_parent tepl_file_chooser_show
file-loader TeplFileLoader tepl_file_loader_new tepl_file_loader_get_buffer tepl_file_loader_get_file tepl_file_loader_get_location tepl_file_loader_load_async tepl_file_loader_load_finish TEPL_FILE_LOADER TEPL_FILE_LOADER_CLASS TEPL_FILE_LOADER_GET_CLASS TEPL_IS_FILE_LOADER TEPL_IS_FILE_LOADER_CLASS TEPL_TYPE_FILE_LOADER TeplFileLoaderClass TeplFileLoaderPrivate tepl_file_loader_get_type
file-saver TeplFileSaver TeplFileSaverFlags tepl_file_saver_new tepl_file_saver_new_with_target tepl_file_saver_get_buffer tepl_file_saver_get_file tepl_file_saver_get_location tepl_file_saver_set_newline_type tepl_file_saver_get_newline_type tepl_file_saver_set_flags tepl_file_saver_get_flags tepl_file_saver_save_async tepl_file_saver_save_finish TEPL_FILE_SAVER TEPL_FILE_SAVER_CLASS TEPL_FILE_SAVER_GET_CLASS TEPL_IS_FILE_SAVER TEPL_IS_FILE_SAVER_CLASS TEPL_TYPE_FILE_SAVER TeplFileSaverClass TeplFileSaverPrivate tepl_file_saver_get_type TEPL_TYPE_FILE_SAVER_FLAGS tepl_file_saver_flags_get_type
fold-region TeplFoldRegion tepl_fold_region_new tepl_fold_region_get_buffer tepl_fold_region_get_folded tepl_fold_region_set_folded tepl_fold_region_get_bounds tepl_fold_region_set_bounds TEPL_TYPE_FOLD_REGION TeplFoldRegionClass
goto-line-bar TeplGotoLineBar tepl_goto_line_bar_new tepl_goto_line_bar_set_view tepl_goto_line_bar_grab_focus_to_entry TEPL_GOTO_LINE_BAR TEPL_GOTO_LINE_BAR_CLASS TEPL_GOTO_LINE_BAR_GET_CLASS TEPL_IS_GOTO_LINE_BAR TEPL_IS_GOTO_LINE_BAR_CLASS TEPL_TYPE_GOTO_LINE_BAR TeplGotoLineBarClass TeplGotoLineBarPrivate tepl_goto_line_bar_get_type
gutter-renderer-folds TeplGutterRendererFolds TeplGutterRendererFoldsState tepl_gutter_renderer_folds_new tepl_gutter_renderer_folds_set_state TEPL_TYPE_GUTTER_RENDERER_FOLDS TeplGutterRendererFoldsClass TEPL_TYPE_GUTTER_RENDERER_FOLDS_STATE tepl_gutter_renderer_folds_state_get_type
info-bar TeplInfoBar TeplInfoBarLocation tepl_info_bar_new tepl_info_bar_new_simple tepl_info_bar_get_icon_from_message_type tepl_info_bar_set_icon_from_message_type tepl_info_bar_get_icon_name tepl_info_bar_set_icon_name tepl_info_bar_add_primary_message tepl_info_bar_add_secondary_message tepl_info_bar_add_content_widget tepl_info_bar_get_handle_close_response tepl_info_bar_set_handle_close_response tepl_info_bar_setup_close_button tepl_info_bar_set_buttons_orientation tepl_info_bar_create_label TEPL_INFO_BAR TEPL_INFO_BAR_CLASS TEPL_INFO_BAR_GET_CLASS TEPL_IS_INFO_BAR TEPL_IS_INFO_BAR_CLASS TEPL_TYPE_INFO_BAR TeplInfoBarClass TeplInfoBarPrivate tepl_info_bar_get_type TEPL_TYPE_INFO_BAR_LOCATION tepl_info_bar_location_get_type
io-error-info-bars tepl_io_error_info_bar_file_already_open tepl_io_error_info_bar_cant_create_backup tepl_io_error_info_bar_externally_modified tepl_io_error_info_bar_saving_externally_modified tepl_io_error_info_bar_invalid_characters
language-chooser TeplLanguageChooser TeplLanguageChooserInterface tepl_language_chooser_select_language TEPL_IS_LANGUAGE_CHOOSER TEPL_LANGUAGE_CHOOSER TEPL_LANGUAGE_CHOOSER_GET_INTERFACE TEPL_TYPE_LANGUAGE_CHOOSER tepl_language_chooser_get_type
language-chooser-dialog TeplLanguageChooserDialog tepl_language_chooser_dialog_new TEPL_IS_LANGUAGE_CHOOSER_DIALOG TEPL_IS_LANGUAGE_CHOOSER_DIALOG_CLASS TEPL_LANGUAGE_CHOOSER_DIALOG TEPL_LANGUAGE_CHOOSER_DIALOG_CLASS TEPL_LANGUAGE_CHOOSER_DIALOG_GET_CLASS TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG TeplLanguageChooserDialogClass TeplLanguageChooserDialogPrivate tepl_language_chooser_dialog_get_type
language-chooser-widget TeplLanguageChooserWidget tepl_language_chooser_widget_new TEPL_LANGUAGE_CHOOSER_WIDGET TEPL_LANGUAGE_CHOOSER_WIDGET_CLASS TEPL_LANGUAGE_CHOOSER_WIDGET_GET_CLASS TEPL_IS_LANGUAGE_CHOOSER_WIDGET TEPL_IS_LANGUAGE_CHOOSER_WIDGET_CLASS TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET TeplLanguageChooserWidgetClass TeplLanguageChooserWidgetPrivate tepl_language_chooser_widget_get_type
line-column-indicator TeplLineColumnIndicator tepl_line_column_indicator_new tepl_line_column_indicator_set_view tepl_line_column_indicator_set_tab_group TEPL_IS_LINE_COLUMN_INDICATOR TEPL_IS_LINE_COLUMN_INDICATOR_CLASS TEPL_LINE_COLUMN_INDICATOR TEPL_LINE_COLUMN_INDICATOR_CLASS TEPL_LINE_COLUMN_INDICATOR_GET_CLASS TEPL_TYPE_LINE_COLUMN_INDICATOR TeplLineColumnIndicatorClass TeplLineColumnIndicatorPrivate tepl_line_column_indicator_get_type
menu-shell tepl_menu_shell_append_edit_actions
metadata TeplMetadata tepl_metadata_new tepl_metadata_get tepl_metadata_set TEPL_IS_METADATA TEPL_IS_METADATA_CLASS TEPL_METADATA TEPL_METADATA_CLASS TEPL_METADATA_GET_CLASS TEPL_TYPE_METADATA TeplMetadataClass TeplMetadataPrivate tepl_metadata_get_type
metadata-manager TeplMetadataManager tepl_metadata_manager_get_singleton tepl_metadata_manager_trim tepl_metadata_manager_load_from_disk tepl_metadata_manager_save_to_disk tepl_metadata_manager_copy_from tepl_metadata_manager_merge_into TEPL_IS_METADATA_MANAGER TEPL_IS_METADATA_MANAGER_CLASS TEPL_METADATA_MANAGER TEPL_METADATA_MANAGER_CLASS TEPL_METADATA_MANAGER_GET_CLASS TEPL_TYPE_METADATA_MANAGER TeplMetadataManagerClass TeplMetadataManagerPrivate tepl_metadata_manager_get_type
object-counters tepl_object_counters_init tepl_object_counters_increment tepl_object_counters_decrement tepl_object_counters_final_check
overwrite-indicator TeplOverwriteIndicator tepl_overwrite_indicator_new tepl_overwrite_indicator_get_overwrite tepl_overwrite_indicator_set_overwrite tepl_overwrite_indicator_set_view TEPL_IS_OVERWRITE_INDICATOR TEPL_IS_OVERWRITE_INDICATOR_CLASS TEPL_OVERWRITE_INDICATOR TEPL_OVERWRITE_INDICATOR_CLASS TEPL_OVERWRITE_INDICATOR_GET_CLASS TEPL_TYPE_OVERWRITE_INDICATOR TeplOverwriteIndicatorClass TeplOverwriteIndicatorPrivate tepl_overwrite_indicator_get_type
panel1 TeplPanel1 tepl_panel1_new tepl_panel1_new_for_left_side_panel tepl_panel1_get_stack tepl_panel1_add_component tepl_panel1_provide_active_component_gsetting tepl_panel1_restore_state_from_gsettings tepl_panel1_save_state_to_gsettings TEPL_IS_PANEL1 TEPL_IS_PANEL1_CLASS TEPL_PANEL1 TEPL_PANEL1_CLASS TEPL_PANEL1_GET_CLASS TEPL_TYPE_PANEL1 TeplPanel1Class TeplPanel1Private tepl_panel1_get_type
panel TeplPanel TeplPanelInterface tepl_panel_add tepl_panel_remove tepl_panel_set_active TEPL_IS_PANEL TEPL_PANEL TEPL_PANEL_GET_INTERFACE TEPL_TYPE_PANEL tepl_panel_get_type
panel-item TeplPanelItem tepl_panel_item_new tepl_panel_item_get_widget tepl_panel_item_get_name tepl_panel_item_get_title tepl_panel_item_get_icon_name tepl_panel_item_get_position tepl_panel_item_compare tepl_panel_item_compare_by_title TEPL_IS_PANEL_ITEM TEPL_IS_PANEL_ITEM_CLASS TEPL_PANEL_ITEM TEPL_PANEL_ITEM_CLASS TEPL_PANEL_ITEM_GET_CLASS TEPL_TYPE_PANEL_ITEM TeplPanelItemClass TeplPanelItemPrivate tepl_panel_item_get_type
panel-notebook TeplPanelNotebook tepl_panel_notebook_new TEPL_IS_PANEL_NOTEBOOK TEPL_IS_PANEL_NOTEBOOK_CLASS TEPL_PANEL_NOTEBOOK TEPL_PANEL_NOTEBOOK_CLASS TEPL_PANEL_NOTEBOOK_GET_CLASS TEPL_TYPE_PANEL_NOTEBOOK TeplPanelNotebookClass TeplPanelNotebookPrivate tepl_panel_notebook_get_type
panel-simple TeplPanelSimple tepl_panel_simple_new tepl_panel_simple_get_items tepl_panel_simple_get_active_item tepl_panel_simple_get_active_item_name tepl_panel_simple_set_active_item_name tepl_panel_simple_has_several_items TEPL_IS_PANEL_SIMPLE TEPL_IS_PANEL_SIMPLE_CLASS TEPL_PANEL_SIMPLE TEPL_PANEL_SIMPLE_CLASS TEPL_PANEL_SIMPLE_GET_CLASS TEPL_TYPE_PANEL_SIMPLE TeplPanelSimpleClass TeplPanelSimplePrivate tepl_panel_simple_get_type
panel-stack TeplPanelStack tepl_panel_stack_new tepl_panel_stack_get_panel_simple tepl_panel_stack_get_stack TEPL_IS_PANEL_STACK TEPL_IS_PANEL_STACK_CLASS TEPL_PANEL_STACK TEPL_PANEL_STACK_CLASS TEPL_PANEL_STACK_GET_CLASS TEPL_TYPE_PANEL_STACK TeplPanelStackClass TeplPanelStackPrivate tepl_panel_stack_get_type
panel-switcher-menu TeplPanelSwitcherMenu tepl_panel_switcher_menu_new TEPL_IS_PANEL_SWITCHER_MENU TEPL_IS_PANEL_SWITCHER_MENU_CLASS TEPL_PANEL_SWITCHER_MENU TEPL_PANEL_SWITCHER_MENU_CLASS TEPL_PANEL_SWITCHER_MENU_GET_CLASS TEPL_TYPE_PANEL_SWITCHER_MENU TeplPanelSwitcherMenuClass TeplPanelSwitcherMenuPrivate tepl_panel_switcher_menu_get_type
pango tepl_pango_font_description_to_css
prefs tepl_prefs_create_checkbutton_simple tepl_prefs_create_font_component tepl_prefs_create_display_line_numbers_checkbutton tepl_prefs_create_tab_width_spinbutton tepl_prefs_create_insert_spaces_component tepl_prefs_create_highlighting_component tepl_prefs_create_files_component tepl_prefs_create_theme_variant_combo_box tepl_prefs_create_right_margin_component tepl_prefs_create_display_statusbar_checkbutton
prefs-dialog TeplPrefsDialog tepl_prefs_dialog_new tepl_prefs_dialog_get_singleton tepl_prefs_dialog_show_for_parent tepl_prefs_dialog_add_reset_all_button TEPL_IS_PREFS_DIALOG TEPL_IS_PREFS_DIALOG_CLASS TEPL_PREFS_DIALOG TEPL_PREFS_DIALOG_CLASS TEPL_PREFS_DIALOG_GET_CLASS TEPL_TYPE_PREFS_DIALOG TeplPrefsDialogClass TeplPrefsDialogPrivate tepl_prefs_dialog_get_type
progress-info-bar TeplProgressInfoBar tepl_progress_info_bar_new tepl_progress_info_bar_set_markup tepl_progress_info_bar_set_text tepl_progress_info_bar_set_fraction tepl_progress_info_bar_pulse TEPL_IS_PROGRESS_INFO_BAR TEPL_IS_PROGRESS_INFO_BAR_CLASS TEPL_PROGRESS_INFO_BAR TEPL_PROGRESS_INFO_BAR_CLASS TEPL_PROGRESS_INFO_BAR_GET_CLASS TEPL_TYPE_PROGRESS_INFO_BAR TeplProgressInfoBarClass TeplProgressInfoBarPrivate tepl_progress_info_bar_get_type
settings TeplSettings TeplSettingsThemeVariant tepl_settings_get_singleton tepl_settings_peek_desktop_interface_settings tepl_settings_provide_font_settings tepl_settings_get_selected_font tepl_settings_handle_theme_variant tepl_settings_provide_style_scheme_settings tepl_settings_get_style_scheme_id tepl_settings_get_range_uint tepl_settings_reset_all TEPL_IS_SETTINGS TEPL_IS_SETTINGS_CLASS TEPL_SETTINGS TEPL_SETTINGS_CLASS TEPL_SETTINGS_GET_CLASS TEPL_TYPE_SETTINGS TeplSettingsClass TeplSettingsPrivate tepl_settings_get_type TEPL_TYPE_SETTINGS_THEME_VARIANT tepl_settings_theme_variant_get_type TEPL_TYPE_SETTINGS_SIMPLE_THEME_VARIANT tepl_settings_simple_theme_variant_get_type
settings-binding-group TeplSettingsBindingGroup tepl_settings_binding_group_new tepl_settings_binding_group_free tepl_settings_binding_group_add tepl_settings_binding_group_unbind
signal-group TeplSignalGroup tepl_signal_group_new tepl_signal_group_clear tepl_signal_group_add
space-drawer-prefs TeplSpaceDrawerPrefs tepl_space_drawer_prefs_new tepl_space_drawer_prefs_get_space_drawer TEPL_IS_SPACE_DRAWER_PREFS TEPL_IS_SPACE_DRAWER_PREFS_CLASS TEPL_SPACE_DRAWER_PREFS TEPL_SPACE_DRAWER_PREFS_CLASS TEPL_SPACE_DRAWER_PREFS_GET_CLASS TEPL_TYPE_SPACE_DRAWER_PREFS TeplSpaceDrawerPrefsClass TeplSpaceDrawerPrefsPrivate tepl_space_drawer_prefs_get_type
statusbar TeplStatusbar tepl_statusbar_new tepl_statusbar_flash_message tepl_statusbar_flash_generic_message TEPL_IS_STATUSBAR TEPL_IS_STATUSBAR_CLASS TEPL_STATUSBAR TEPL_STATUSBAR_CLASS TEPL_STATUSBAR_GET_CLASS TEPL_TYPE_STATUSBAR TeplStatusbarClass TeplStatusbarPrivate tepl_statusbar_get_type
status-menu-button TeplStatusMenuButton tepl_status_menu_button_new tepl_status_menu_button_set_label_text TEPL_IS_STATUS_MENU_BUTTON TEPL_IS_STATUS_MENU_BUTTON_CLASS TEPL_STATUS_MENU_BUTTON TEPL_STATUS_MENU_BUTTON_CLASS TEPL_STATUS_MENU_BUTTON_GET_CLASS TEPL_TYPE_STATUS_MENU_BUTTON TeplStatusMenuButtonClass TeplStatusMenuButtonPrivate tepl_status_menu_button_get_type
style-scheme-chooser-full TeplStyleSchemeChooserFull tepl_style_scheme_chooser_full_new TEPL_IS_STYLE_SCHEME_CHOOSER_FULL TEPL_IS_STYLE_SCHEME_CHOOSER_FULL_CLASS TEPL_STYLE_SCHEME_CHOOSER_FULL TEPL_STYLE_SCHEME_CHOOSER_FULL_CLASS TEPL_STYLE_SCHEME_CHOOSER_FULL_GET_CLASS TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL TeplStyleSchemeChooserFullClass TeplStyleSchemeChooserFullPrivate tepl_style_scheme_chooser_full_get_type
style-scheme-chooser-simple TeplStyleSchemeChooserSimple tepl_style_scheme_chooser_simple_new tepl_style_scheme_chooser_simple_get_style_scheme_id tepl_style_scheme_chooser_simple_set_style_scheme_id TEPL_IS_STYLE_SCHEME_CHOOSER_SIMPLE TEPL_IS_STYLE_SCHEME_CHOOSER_SIMPLE_CLASS TEPL_STYLE_SCHEME_CHOOSER_SIMPLE TEPL_STYLE_SCHEME_CHOOSER_SIMPLE_CLASS TEPL_STYLE_SCHEME_CHOOSER_SIMPLE_GET_CLASS TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE TeplStyleSchemeChooserSimpleClass TeplStyleSchemeChooserSimplePrivate tepl_style_scheme_chooser_simple_get_type
tab TeplTab TeplTabClass tepl_tab_new tepl_tab_new_with_view tepl_tab_get_view tepl_tab_get_buffer tepl_tab_get_goto_line_bar tepl_tab_add_info_bar tepl_tab_load_file tepl_tab_save_async tepl_tab_save_finish tepl_tab_save_async_simple tepl_tab_save_as_async tepl_tab_save_as_finish tepl_tab_save_as_async_simple TEPL_IS_TAB TEPL_IS_TAB_CLASS TEPL_TAB TEPL_TAB_CLASS TEPL_TAB_GET_CLASS TEPL_TYPE_TAB TeplTabPrivate tepl_tab_get_type
tab-group TeplTabGroup TeplTabGroupInterface tepl_tab_group_get_tabs tepl_tab_group_get_views tepl_tab_group_get_buffers tepl_tab_group_get_active_tab tepl_tab_group_set_active_tab tepl_tab_group_get_active_view tepl_tab_group_get_active_buffer tepl_tab_group_append_tab TEPL_IS_TAB_GROUP TEPL_TAB_GROUP TEPL_TAB_GROUP_GET_INTERFACE TEPL_TYPE_TAB_GROUP tepl_tab_group_get_type
tab-label TeplTabLabel TeplTabLabelClass tepl_tab_label_new tepl_tab_label_get_tab tepl_tab_label_update_tooltip TEPL_IS_TAB_LABEL TEPL_IS_TAB_LABEL_CLASS TEPL_TAB_LABEL TEPL_TAB_LABEL_CLASS TEPL_TAB_LABEL_GET_CLASS TEPL_TYPE_TAB_LABEL TeplTabLabelPrivate tepl_tab_label_get_type
notebook TeplNotebook tepl_notebook_new TEPL_IS_NOTEBOOK TEPL_IS_NOTEBOOK_CLASS TEPL_NOTEBOOK TEPL_NOTEBOOK_CLASS TEPL_NOTEBOOK_GET_CLASS TEPL_TYPE_NOTEBOOK TeplNotebookClass TeplNotebookPrivate tepl_notebook_get_type
utils TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY tepl_utils_str_middle_truncate tepl_utils_str_end_truncate tepl_utils_str_replace tepl_utils_markup_escape_text tepl_utils_get_file_extension tepl_utils_get_file_shortname tepl_utils_replace_home_dir_with_tilde tepl_utils_decode_uri tepl_utils_create_parent_directories tepl_utils_file_query_exists_async tepl_utils_file_query_exists_finish tepl_utils_create_close_button tepl_utils_show_warning_dialog tepl_utils_list_box_clear tepl_utils_list_box_setup_scrolling tepl_utils_list_box_scroll_to_row tepl_utils_list_box_scroll_to_selected_row tepl_utils_list_box_get_row_at_index_with_filter tepl_utils_list_box_get_filtered_children tepl_utils_override_font_description tepl_utils_override_font_string tepl_utils_get_titled_component tepl_utils_setup_statusbar tepl_utils_set_widget tepl_utils_get_toplevel_window tepl_utils_binding_transform_func_smart_bool tepl_utils_can_use_gsettings_schema tepl_utils_can_use_gsettings_key
view TeplView tepl_view_new tepl_view_new_with_buffer tepl_view_cut_clipboard tepl_view_copy_clipboard tepl_view_paste_clipboard tepl_view_delete_selection tepl_view_select_all tepl_view_scroll_to_cursor tepl_view_goto_line tepl_view_goto_line_offset tepl_view_select_lines TEPL_TYPE_VIEW TeplViewClass
window-state tepl_window_state_init
libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/meson.build000066400000000000000000000034361526404732400272520ustar00rootroot00000000000000subdir('xml') gtkdoc_module_name = '@0@-@1@'.format(meson.project_name(), TEPL_API_VERSION) FS.copyfile( '@0@-sections.txt'.format(meson.project_name()), '@0@-sections.txt'.format(gtkdoc_module_name) ) html_dir = get_option('prefix') / GNOME.gtkdoc_html_dir(gtkdoc_module_name) glib_docpath = dependency('glib-2.0').get_variable(pkgconfig: 'prefix') / 'share/gtk-doc/html/glib' gobject_docpath = dependency('gobject-2.0').get_variable(pkgconfig: 'prefix') / 'share/gtk-doc/html/gobject' gio_docpath = dependency('gio-2.0').get_variable(pkgconfig: 'prefix') / 'share/gtk-doc/html/gio' gtk_docpath = dependency('gtk+-3.0').get_variable(pkgconfig: 'prefix') / 'share/gtk-doc/html/gtk3' gsv_docpath = dependency('libgedit-gtksourceview-300').get_variable(pkgconfig: 'prefix') / 'share/gtk-doc/html/libgedit-gtksourceview-300' amtk_docpath = dependency('libgedit-amtk-5').get_variable(pkgconfig: 'prefix') / 'share/gtk-doc/html/libgedit-amtk-5' gfls_docpath = dependency('libgedit-gfls-1').get_variable(pkgconfig: 'prefix') / 'share/gtk-doc/html/libgedit-gfls-1' GNOME.gtkdoc( gtkdoc_module_name, main_xml: '@0@-docs.xml'.format(meson.project_name()), src_dir: include_directories('../../tepl/'), dependencies: TEPL_LIB_DEP, scan_args: ['--rebuild-types'], gobject_typesfile: '@0@.types'.format(gtkdoc_module_name), fixxref_args: [ '--html-dir=@0@'.format(html_dir), '--extra-dir=@0@'.format(glib_docpath), '--extra-dir=@0@'.format(gobject_docpath), '--extra-dir=@0@'.format(gio_docpath), '--extra-dir=@0@'.format(gtk_docpath), '--extra-dir=@0@'.format(gsv_docpath), '--extra-dir=@0@'.format(amtk_docpath), '--extra-dir=@0@'.format(gfls_docpath) ], content_files: [ 'api-breaks.xml', 'intro.xml', ], ignore_headers: TEPL_PRIVATE_HEADERS, install: true ) libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/xml/000077500000000000000000000000001526404732400257025ustar00rootroot00000000000000gtkdocentities.ent.in000066400000000000000000000001421526404732400317550ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/xml libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/reference/xml/meson.build000066400000000000000000000006401526404732400300440ustar00rootroot00000000000000gtkdocentities_conf_data = configuration_data() gtkdocentities_conf_data.set('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version())) gtkdocentities_conf_data.set('PACKAGE_API_VERSION', TEPL_API_VERSION) gtkdocentities_filename = 'gtkdocentities.ent' configure_file( input: gtkdocentities_filename + '.in', output: gtkdocentities_filename, configuration: gtkdocentities_conf_data ) libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/docs/roadmap.md000066400000000000000000000012731526404732400251140ustar00rootroot00000000000000libgedit-tepl roadmap ===================== This page contains the plans for major code changes we hope to get done in the future. File loading and saving plans ----------------------------- - Improve the implementation in libgedit-gtksourceview instead of duplicating the API in libgedit-tepl (Encoding, File, FileLoader and FileSaver classes). Once done, remove the relevant classes from libgedit-tepl. - In libgedit-tepl: provide the high-level API with TeplInfoBars etc. Search and replace UI --------------------- - Status: **todo** File printing UI ---------------- - Status: **todo** File browser widget ------------------- - Status: **todo** To be integrated in a side panel. libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/libgedit-tepl.doap000066400000000000000000000020531526404732400256060ustar00rootroot00000000000000 libgedit-tepl Gedit Technology - Text editor product line libgedit-tepl is part of Gedit Technology. It is a library that eases the development of text editors and IDEs based on GTK. C Sébastien Wilmet swilmet libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/meson.build000066400000000000000000000075331526404732400243660ustar00rootroot00000000000000# Convention: # - Local variables in lower_case. # - Global variables in UPPER_CASE. # See: https://github.com/mesonbuild/meson/issues/2607 project( 'libgedit-tepl', 'c', meson_version: '>= 0.64', version: '6.15.0', # Do not forget to update the SOVERSION if needed. default_options: ['warning_level=2'] ) SOVERSION = 5 GNOME = import('gnome') PKG_CONFIG = import('pkgconfig') I18N = import('i18n') FS = import('fs') # API version, used for parallel installability. TEPL_API_VERSION = '6' TEPL_PUBLIC_DEPS = [ dependency('gio-2.0', version: '>= 2.74'), dependency('gtk+-3.0', version: '>= 3.22'), dependency('libgedit-gtksourceview-300', version: '>= 299.8'), dependency('libgedit-amtk-5', version: '>= 5.11'), dependency('libgedit-gfls-1', version: '>= 0.5'), ] tepl_private_deps = [ dependency('icu-uc'), dependency('icu-i18n'), dependency('gsettings-desktop-schemas', version: '>= 42'), dependency('libhandy-1', version: '>= 1.6'), ] TEPL_DEPS = [TEPL_PUBLIC_DEPS, tepl_private_deps] # config.h config_data = configuration_data() GETTEXT_PACKAGE_NAME = '@0@-@1@'.format(meson.project_name(), TEPL_API_VERSION) config_data.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE_NAME) config_data.set_quoted('TEPL_LOCALEDIR', get_option('prefix') / get_option('localedir')) configure_file( output: 'config.h', configuration: config_data ) # Misc ROOT_INCLUDE_DIR = include_directories('.') add_project_arguments( '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()), language: 'c' ) ##### # CFLAGS # Some flags are missing when using only the builtin warning_level meson option, # even at the maximum level. # The following warning_cflags suppose that warning_level=2. c_compiler = meson.get_compiler('c') warning_cflags = [] warning_cflags_to_force = [] if c_compiler.get_id() == 'msvc' # Use GLib's msvc_recommended_pragmas.h to filter out # the warnings we don't really need to worry about, # but do make the ones we want to be wary stand out warning_cflags += [ '-FImsvc_recommended_pragmas.h', ] else # Try to mimic the AX_COMPILER_FLAGS Autotools macro. warning_cflags += [ '-fno-strict-aliasing', '-Wundef', '-Wnested-externs', '-Wwrite-strings', '-Wpointer-arith', '-Wmissing-declarations', '-Wmissing-prototypes', '-Wstrict-prototypes', '-Wredundant-decls', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wdeclaration-after-statement', '-Wformat=2', '-Wold-style-definition', '-Wcast-align', '-Wformat-nonliteral', '-Wformat-security', '-Wsign-compare', '-Wstrict-aliasing', '-Wshadow', '-Winline', '-Wpacked', '-Wmissing-format-attribute', '-Wmissing-noreturn', '-Winit-self', '-Wredundant-decls', '-Wmissing-include-dirs', '-Wunused-but-set-variable', '-Warray-bounds', '-Wimplicit-function-declaration', '-Wreturn-type', '-Wswitch-enum', '-Wswitch-default', '-Wduplicated-cond', '-Wduplicated-branches', '-Wlogical-op', '-Wrestrict', '-Wnull-dereference', '-Wjump-misses-init', '-Wdouble-promotion', ] warning_cflags_to_force += [ # To be able to build with GCC and still support Clang code completion in # the text editor. '-Wno-unknown-warning-option', ] endif supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags) add_project_arguments(supported_warning_cflags, language: 'c') add_project_arguments(warning_cflags_to_force, language: 'c') ##### end CFLAGS subdir('po') subdir('tepl') if get_option('tests') subdir('tests') endif if get_option('gtk_doc') subdir('docs/reference') endif summary('API version', TEPL_API_VERSION) summary('Prefix', get_option('prefix')) summary('GObject Introspection', get_option('gobject_introspection')) summary('API documentation', get_option('gtk_doc')) summary('Build tests', get_option('tests')) libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/meson_options.txt000066400000000000000000000005331526404732400256520ustar00rootroot00000000000000option( 'gobject_introspection', type: 'boolean', value: true, description: 'Build GObject Introspection data (requires gobject-introspection)' ) option( 'gtk_doc', type: 'boolean', value: true, description: 'Build API reference (requires gtk-doc)' ) option( 'tests', type: 'boolean', value: true, description: 'Build tests' ) libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/000077500000000000000000000000001526404732400226325ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/LINGUAS000066400000000000000000000002611526404732400236560ustar00rootroot00000000000000# Set of available languages. # Please keep this list sorted alphabetically. be ca cs da de el en_GB es eu fr fur hr id hu ja ka kk nl nn pl pt pt_BR ro ru sr sl sv tr uk zh_CN libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/POTFILES.in000066400000000000000000000030561526404732400244130ustar00rootroot00000000000000# List of source files containing translatable strings. tepl/code-comment/tepl-code-comment-view.c tepl/tepl-abstract-factory.c tepl/tepl-application.c tepl/tepl-application-window.c tepl/tepl-buffer.c tepl/tepl-close-confirm-dialog-single.c tepl/tepl-file.c tepl/tepl-file-chooser.c tepl/tepl-file-loader.c tepl/tepl-file-saver.c tepl/tepl-goto-line-bar.c tepl/tepl-icu.c tepl/tepl-info-bar.c tepl/tepl-init.c tepl/tepl-io-error-info-bars.c tepl/tepl-language-chooser.c tepl/tepl-language-chooser-dialog.c tepl/tepl-language-chooser-widget.c tepl/tepl-line-column-indicator.c tepl/tepl-menu-shell.c tepl/tepl-metadata-attic.c tepl/tepl-metadata.c tepl/tepl-metadata-manager.c tepl/tepl-metadata-parser.c tepl/tepl-notebook.c tepl/tepl-object-counters.c tepl/tepl-overwrite-indicator.c tepl/tepl-panel1.c tepl/tepl-panel.c tepl/tepl-panel-item.c tepl/tepl-panel-notebook.c tepl/tepl-panel-simple.c tepl/tepl-panel-stack.c tepl/tepl-panel-switcher-menu.c tepl/tepl-pango.c tepl/tepl-prefs.c tepl/tepl-prefs-dialog.c tepl/tepl-progress-info-bar.c tepl/tepl-settings-binding-group.c tepl/tepl-settings.c tepl/tepl-signal-group.c tepl/tepl-space-drawer-prefs.c tepl/tepl-statusbar.c tepl/tepl-status-menu-button.c tepl/tepl-style-scheme-chooser-full.c tepl/tepl-style-scheme-chooser-simple.c tepl/tepl-style-scheme-row.c tepl/tepl-tab.c tepl/tepl-tab-group.c tepl/tepl-tab-label.c tepl/tepl-tab-loading.c tepl/tepl-tab-saving.c tepl/tepl-utils.c tepl/tepl-view.c tepl/tepl-window-actions-edit.c tepl/tepl-window-actions-file.c tepl/tepl-window-actions-search.c tepl/tepl-window-state.c libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/POTFILES.skip000066400000000000000000000000351526404732400247450ustar00rootroot00000000000000tests/unit-tests/test-file.c libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/be.po000066400000000000000000000475651526404732400236010ustar00rootroot00000000000000# Belarusian translation for libgedit-tepl. # Copyright (C) 2024 libgedit-tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the libgedit-tepl package. # Yuras Shumovich , 2024. # msgid "" msgstr "" "Project-Id-Version: libgedit-tepl main\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-02-07 08:32+0000\n" "PO-Revision-Date: 2025-05-07 04:12+0300\n" "Last-Translator: Yuras Shumovich \n" "Language-Team: Belarusian \n" "Language: be\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Poedit 3.6\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Новы" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Новы файл" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Новае _акно" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Стварыць новае акно" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Адкрыць" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Адкрыць файл" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Захаваць" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Захаваць бягучы файл" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Захаваць _як" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Захаваць бягучы файл у іншым месцы" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Адрабіць" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Адрабіць апошняе дзеянне" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Паўтарыць" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Паўтарыць апошняе адробленае дзеянне" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Выразаць" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Выразаць вылучанае" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "С_капіяваць" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Скапіяваць вылучанае" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Уставіць" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Уставіць з буфера абмену" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "Вы_даліць" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Выдаліць вылучаны тэкст" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Вы_лучыць усё" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Вылучыць увесь тэкст" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Дадаць водступ" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Дадаць водступы ў вылучаных радках" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Прыбраць водступы" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Прыбраць водступы ў вылучаных радках" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "Пера_йсці на радок…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Перайсці на пэўны радок" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Толькі чытанне" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Захаваць змены ў файле «%s» перад закрыццём?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Закрыць _без захавання" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Скасаваць" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Захаваць як…" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Змесціва павінна мець кадаванне UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Перайсці на радок:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Закрыць" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Гэты файл (%s) ужо адкрыты ў іншым акне %s." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "Адкрыты экзэмпляр файла %s нельга змяняць. Усё роўна рэдагаваць?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "Усё роўна _рэдагаваць" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "Пакінуць толькі для _чытання" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "" "Не ўдалося стварыць запасную копію зыходнага файла перад захаваннем «%s»." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Не ўдалося стварыць запасную копію са старым змесцівам файла перад яго " "абнаўленнем. Вы можаце праігнараваць гэта паведамленне і ўсё роўна захаваць " "файл, але калі падчас захавання адбудзецца памылка, вы можаце страціць " "старую копію файла. Усё роўна захаваць?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Тэкст памылкі: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "Усё роўна _захаваць" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Не захоўваць" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Файл «%s» змяніўся на дыску." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "Дакумент мае незахаваныя змены. Ануляваць іх і перазагрузіць файл?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Перазагрузіць файл?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Ануляваць змены і пера_загрузіць" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Перазагрузіць" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Ігнараваць" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Файл «%s» зменены іншай праграмай." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Калі захаваеце яго, усе змены зробленыя іншай праграмай могуць страціцца. " "Усё роўна захаваць?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Падчас захавання «%s» выяўлены недапушчальныя сімвалы." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Калі працягнуць захаванне гэтага файла, дакумент можа быць пашкоджаны. Усё " "роўна захаваць?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Рэжым падсветкі" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Выбраць" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Звычайны тэкст" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Пошук рэжыму падсветкі…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Рад. %d, Слуп %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Файл XML павінен пачынацца з элемента , не з «%s»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Чакаўся элемент , замест яго атрыманы «%s»." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Не ўдалося прааналізаваць значэнне атрыбута «atime» «%s»." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Элемент павінен змяшчаць атрыбуты «uri» і «atime»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Чакаўся элемент , замест яго атрыманы «%s»." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "У элеменце адсутнічае атрыбут «key» або «value»." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "УСТ" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ЗАМ" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Схаваць панэль" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Выкарыстоўваць сістэмную фіксаваную шырыню шрыфту (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "_Шрыфт рэдактара:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Шрыфт" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "Па_казваць нумарацыю радкоў" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Шырыня табуляцыі:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "_Устаўляць прабелы замест знакаў табуляцыі" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Забудзьцеся, што не карыстаецеся табуляцыямі" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Пад_свечваць бягучы радок" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Падсвечваць _адпаведныя парныя дужкі" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Падсветка" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Аўтазахаванне файлаў" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Колькасць хвілін паміж аўтазахаваннем:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "Ствараць _запасныя копіі файлаў перад захаваннем" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Файлы" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Прытрымлівацца стылю сістэмы" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Светлы стыль" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Цёмны стыль" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Варыянт тэмы" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Паказваць правае _поле на слупку:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Паказваць радок стану" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Параметры" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Сапраўды хочаце скінуць усе параметры?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Скінуць усе" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Скінуць усе…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Скінуць усе параметры" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Паказ табуляцый" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Паказ прабелаў" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Паказ знакаў новага радка" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Пачатковыя прабелы" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Прабелы ў тэксце" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Канцавыя прабелы" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Табуляцыя" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Прабел" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Непарыўны прабел" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Вузкі непарыўны прабел" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Вынік" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Звесткі" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Калі ўключаны паказ прабельных сімвалаў, будуць заўсёды і ўсюды паказвацца " "непарыўныя прабелы, каб адрозніваць іх ад звычайных прабелаў." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Колеравая схема для цёмнага варыянта тэмы" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Колеравая схема для светлага варыянта тэмы" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Не падтрымліваецца для цёмнага варыянта тэмы" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Не падтрымліваецца для светлага варыянта тэмы" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Размяшчэнне:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Закрыць файл" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Памылка падчас загрузкі файла." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Памылка падчас захавання файла." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Захаваць файл" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Адкрыць файл" #~ msgid "Unicode" #~ msgstr "Юнікод" #~ msgid "Western" #~ msgstr "Заходняе" #~ msgid "Central European" #~ msgstr "Цэнтральнаеўрапейскае" #~ msgid "South European" #~ msgstr "Паўднёваеўрапейскае" #~ msgid "Baltic" #~ msgstr "Балцкае" #~ msgid "Cyrillic" #~ msgstr "Кірыліца" #~ msgid "Arabic" #~ msgstr "Арабскае" #~ msgid "Greek" #~ msgstr "Грэчаскае" #~ msgid "Hebrew Visual" #~ msgstr "Іўрыт (бачны)" #~ msgid "Turkish" #~ msgstr "Турэцкае" #~ msgid "Nordic" #~ msgstr "Скандынаўскае" #~ msgid "Celtic" #~ msgstr "Кельцкае" #~ msgid "Romanian" #~ msgstr "Румынскае" #~ msgid "Armenian" #~ msgstr "Армянскае" #~ msgid "Chinese Traditional" #~ msgstr "Кітайскае традыцыйнае" #~ msgid "Cyrillic/Russian" #~ msgstr "Кірылічнае/Рускае" #~ msgid "Japanese" #~ msgstr "Японскае" #~ msgid "Korean" #~ msgstr "Карэйскае" #~ msgid "Chinese Simplified" #~ msgstr "Кітайскае спрошчанае" #~ msgid "Georgian" #~ msgstr "Грузінскае" #~ msgid "Hebrew" #~ msgstr "Іўрыт" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Кірылічнае/Украінскае" #~ msgid "Vietnamese" #~ msgstr "В'етнамскае" #~ msgid "Thai" #~ msgstr "Тайскае" #, c-format #~ msgid "%s (%s)" #~ msgstr "%s (%s)" #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgid "Display _grid pattern" #~ msgstr "Паказваць _сетку" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/ca.po000066400000000000000000000266351526404732400235710ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Jordi Mas i Hernàndez , 2020 # msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-11-05 22:45+0000\n" "PO-Revision-Date: 2020-07-11 23:07+0200\n" "Last-Translator: Jordi Mas \n" "Language-Team: \n" "Language: ca\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.3\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nou" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Fitxer nou" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "_Finestra nova" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Crea una finestra nova" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Obre" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Obre un fitxer" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Desa" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Desa el fitxer actual" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "_Anomena i desa" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Desa el fitxer actual a una ubicació diferent" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Desfés" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Desfer la darrera acció" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Refés" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Refés l'última acció desfeta" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Re_talla" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Retalla la selecció" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Copia" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Copia la selecció" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Enganxa" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Enganxa el porta-retalls" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Suprimeix" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Suprimeix el text seleccionat" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "S_elecciona-ho tot" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Selecciona tot el text" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "Sa_gna" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Sagna les línies seleccionades" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Desfés el sagnat" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Desfés el sagnat de les línies seleccionades" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Ves a la línia…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Ves a una línia específica" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Només lectura" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Voleu desar els canvis «%s» al fitxer abans de tancar?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "_Tanca sense desar" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:120 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Cancel·la" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Anomena i desa…" #: tepl/tepl-file.c:426 #, c-format msgid "Untitled File %d" msgstr "Fitxer sense nom %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "" "El contingut ha d'estar codificat amb la codificació de caràcters UTF-8." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Ves a la línia:" #: tepl/tepl-goto-line-bar.c:243 msgid "Close" msgstr "Tanca" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "_Edita en qualsevol cas" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_No ho editeu" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Aquest fitxer «%s» ja està obert en una altra finestra." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Voleu editar-lo igualment?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "_Desa-ho de totes maneres" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_No ho desis" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "" "No s'ha pogut crear un fitxer de còpia de seguretat mentre es desava «%s»" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "No s'ha pogut fer una còpia de seguretat de la còpia antiga del fitxer abans" " de desar-ne la nova. Podeu ignorar aquest avís i desar el fitxer de totes " "maneres, però si es produeix un error en desar, podríeu perdre la còpia antiga" " del fitxer. Voleu desar-ho igualment?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Missatge d'error: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "El fitxer «%s» ha canviat al disc." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "_Descarta els canvis i torna a carregar" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Torna a carregar" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "S'han detectat alguns caràcters no vàlids en desar «%s»." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Si continueu desant aquest fitxer podeu corrompre el document. Voleu desar-" "ho igualment?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:115 msgid "Highlight Mode" msgstr "Mode de ressaltat" #: tepl/tepl-language-chooser-dialog.c:121 msgid "_Select" msgstr "S_elecciona" #: tepl/tepl-language-chooser-widget.c:71 msgid "Plain Text" msgstr "Text pla" #: tepl/tepl-language-chooser-widget.c:441 msgid "Search highlight mode…" msgstr "Cerca en mode ressaltat…" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "El fitxer XML ha de començar amb un element no amb «%s»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "S'esperava un element , però s'ha obtingut «%s»." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "No s'ha pogut analitzar el valor de l'atribut «atime» «%s»." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "L'element ha de contenir els atributs «uri» i «atime»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "S'esperava un element , en comptes s'ha obtingut «%s»." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "L'element ha de contenir els atributs «key» o «value»." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Amaga el quadre" #: tepl/tepl-space-drawer-prefs.c:189 tepl/tepl-space-drawer-prefs.c:191 #: tepl/tepl-space-drawer-prefs.c:193 msgid "Draw tabs" msgstr "Dibuixa tabuladors" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw spaces" msgstr "Dibuixa els espais" #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw new lines" msgstr "Dibuixa línies noves" #: tepl/tepl-space-drawer-prefs.c:231 msgid "Leading Spaces" msgstr "Espais inicials" #: tepl/tepl-space-drawer-prefs.c:235 msgid "Spaces Inside Text" msgstr "Espais dins del text" #: tepl/tepl-space-drawer-prefs.c:239 msgid "Trailing Spaces" msgstr "Espais al final" #: tepl/tepl-space-drawer-prefs.c:259 msgid "Tab" msgstr "Tabulador" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Space" msgstr "Espai" #: tepl/tepl-space-drawer-prefs.c:261 msgid "No-Break Space" msgstr "Espai no divisible" #: tepl/tepl-space-drawer-prefs.c:262 msgid "Narrow No-Break Space" msgstr "Espai estret no divisible" #: tepl/tepl-space-drawer-prefs.c:281 msgid "Result" msgstr "Resultat" #: tepl/tepl-space-drawer-prefs.c:314 msgid "Information" msgstr "Informació" #: tepl/tepl-space-drawer-prefs.c:316 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Quan el dibuix d'espais en blanc està activat, els espais no divisibles " "sempre es dibuixen en totes les ubicacions, per a distingir-los dels espais " "normals." #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Ln %d, Col %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Ubicació:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Tanca el fitxer" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "S'ha produït un error mentre es carregava el fitxer." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "S'ha produït un error mentre es desava el fitxer." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Desa el fitxer" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Obre fitxer" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/cs.po000066400000000000000000000266431526404732400236120ustar00rootroot00000000000000# Czech translation for tepl. # Copyright (C) 2017 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Marek Černocký , 2017, 2018, 2020. # msgid "" msgstr "" "Project-Id-Version: tepl\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-11-05 22:45+0000\n" "PO-Revision-Date: 2020-11-15 10:19+0100\n" "Last-Translator: Marek Černocký \n" "Language-Team: čeština \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" "X-Generator: Gtranslator 2.91.7\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nový" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Nový soubor" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "No_vé okno" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Vytvořit nové okno" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Otevřít" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Otevřít soubor" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Uložit" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Uložit aktuální soubor" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Uložit j_ako" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Uložit aktuální soubor na jiné místo" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Zpět" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Vrátit zpět poslední úkon" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "Zno_vu" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Znovu provást poslední vrácený úkon" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Vyjmout" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Vyjmout výběr" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopírovat" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopírovat výběr" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "V_ložit" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Vložit obsah schránky" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Smazat" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Smazat vybraný text" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Vybr_at vše" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Vybrat všechen text" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "Odsad_it" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Odsadit vybrané řádky" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "Zr_ušit odsazení" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Zrušit odsazení vybraných řádků" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Přejít na řádek…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Přejít na konkrétní řádek" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Jen ke čtení" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Uložit před zavřením změny do souboru „%s“?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Zavřít _bez uložení" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:120 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Zrušit" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Uložit j_ako…" #: tepl/tepl-file.c:426 #, c-format msgid "Untitled File %d" msgstr "Nepojmenovaný soubor %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Obsah musí být kódovaný pomocí kódování znaků UTF-8." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Přejít na řádek:" #: tepl/tepl-goto-line-bar.c:243 msgid "Close" msgstr "Zavřít" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "Př_esto upravovat" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_Neupravovat" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Tento soubor „%s“ je již otevřený v jiném okně." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Chcete jej přesto upravovat?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "Př_esto uložit" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Neukládat" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "Při ukládání souboru „%s“ se nezdařilo vytvořit zálohu." #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Nezdařilo se zazálohovat starou kopii souboru před uložením nové. Můžete " "varování ignorovat a soubor i tak uložit, ale pokud dojde při ukládání k " "nějaké chybě, můžete o starou kopii přijít. Přesto uložit?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Chybová zpráva: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "Soubor „%s“ byl změněn na disku." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Zahodit změny a znovu _načíst" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "Znovu _načíst" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Při ukládání „%s“ byly zjištěny neplatné znaky." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Pokud budete pokračovat v ukládání, může dojít k porušení dokumentu. Přesto " "uložit?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:115 msgid "Highlight Mode" msgstr "Režim zvýrazňování" #: tepl/tepl-language-chooser-dialog.c:121 msgid "_Select" msgstr "_Vybrat" #: tepl/tepl-language-chooser-widget.c:71 msgid "Plain Text" msgstr "Prostý text" #: tepl/tepl-language-chooser-widget.c:441 msgid "Search highlight mode…" msgstr "hledat režim zvýrazňování…" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Soubor XML musí začínat elementem , a ne „%s“." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Očekáván element , místo toho obdržen „%s“." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Selhalo zpravování hodnoty „%s“ pro atribut „atime“." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Element musí obsahovat atributy „uri“ a „atime“." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Očekáván element , místo toho obdržen „%s“." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Elementu schází atribut „key“ nebo „value“." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Skrýt panel" #: tepl/tepl-space-drawer-prefs.c:189 tepl/tepl-space-drawer-prefs.c:191 #: tepl/tepl-space-drawer-prefs.c:193 msgid "Draw tabs" msgstr "Vykreslovat tabulátory" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw spaces" msgstr "Vykraslovat mezery" #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw new lines" msgstr "Vykreslovat zalomení řádků" #: tepl/tepl-space-drawer-prefs.c:231 msgid "Leading Spaces" msgstr "Počáteční mezery" #: tepl/tepl-space-drawer-prefs.c:235 msgid "Spaces Inside Text" msgstr "Mezery uvnitř textu" #: tepl/tepl-space-drawer-prefs.c:239 msgid "Trailing Spaces" msgstr "Koncové mezery" #: tepl/tepl-space-drawer-prefs.c:259 msgid "Tab" msgstr "Tabulátor" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Space" msgstr "Mezera" #: tepl/tepl-space-drawer-prefs.c:261 msgid "No-Break Space" msgstr "Nezalomitelná mezera" #: tepl/tepl-space-drawer-prefs.c:262 msgid "Narrow No-Break Space" msgstr "Úzká nezalomitelná mezera" #: tepl/tepl-space-drawer-prefs.c:281 msgid "Result" msgstr "Výsledek" #: tepl/tepl-space-drawer-prefs.c:314 msgid "Information" msgstr "Informace" #: tepl/tepl-space-drawer-prefs.c:316 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Když je zapnuté vykreslování bílých znaků, jsou nezalomitelné mezery " "vykreslovány na všech místech, aby se rozlišily od normálních mezer." #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "ř %d, sl %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Umístění:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Zavřít soubor" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Chyba při načítání souboru." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Chyba při ukládání souboru." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Uložení souboru" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Otevření souboru" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/da.po000066400000000000000000000420501526404732400235570ustar00rootroot00000000000000# Danish translation for tepl. # Copyright (C) 2018 Free Software Foundation, Inc. # This file is distributed under the same license as the tepl package. # Joe Hansen , 2018. # scootergrisen, 2020. # Alan Mortensen , 2024-25. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-02-07 08:32+0000\n" "PO-Revision-Date: 2025-02-18 19:34+0100\n" "Last-Translator: Alan Mortensen \n" "Language-Team: Danish \n" "Language: da\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.4.2\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Ny" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Ny fil" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Nyt _vindue" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Opret et nyt vindue" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Åbn" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Åbn en fil" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Gem" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Gem den nuværende fil" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Gem _som" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Gem den nuværende fil til en anden placering" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Fortryd" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Fortryd den sidste handling" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Omgør" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Omgør den sidste fortrudte handling" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "K_lip" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Klip markeringen" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopiér" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopiér markeringen" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Indsæt" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Indsæt udklipsholderen" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Slet" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Slet den markerede tekst" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Markér _alt" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Markér al teksten" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "Indr_yk" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Indryk de markerede linjer" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Fjern indryk" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Fjern indrykning af de markerede linjer" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Gå til linje …" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Gå til en bestemt linje" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Skrivebeskyttet" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Gem ændringer til filen “%s” inden lukning?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Luk _uden at gemme" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Annullér" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Gem som …" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Indholdet skal være kodet med tegnkodningen UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Gå til linje:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Luk" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Filen (%s) er allerede åben i et andet %s-vindue." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s åbnede denne forekomst af filen på en måde, så den ikke kan redigeres. " "Vil du redigere den alligevel?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Rediger alligevel" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Bevar som skrivebeskyttet" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Kunne ikke oprette en sikkerhedskopi, mens “%s” blev gemt." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Kunne ikke sikkerhedskopiere den gamle kopi af filen, inden den nye blev " "gemt. Du kan ignorere advarslen og gemme filen alligevel, men hvis der " "opstår en fejl, mens der gemmes, kan du miste den gamle kopi af filen. Gem " "alligevel?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Fejlmeddelelse: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "Gem _alligevel" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "Gem _ikke" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Filen “%s” blev ændret på disken." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Dette dokument indeholder ændringer, som ikke er gemt. Vil du droppe dine " "ændringer og genindlæse filen?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Vil du genindlæse filen?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Drop ændringer og _genindlæs" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Genindlæs" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Ignorér" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Filen “%s” blev ændret i et andet program." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "Hvis du gemmer den, går alle eksterne ændringer tabt. Gem alligevel?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Der blev registreret ugyldige tegn, mens “%s” blev gemt." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Hvis du fortsætter med at gemme filen kan du ødelægge dokumentet. Gem " "alligevel?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Fremhævningstilstand" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Vælg" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Klartekst" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Søg efter fremhævningstilstand …" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Ln %d, kol %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML-filen skal begynde med et -element, ikke “%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Ventede et -element, fik i stedet “%s”." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Kunne ikke fortolke “atime”-attributtens værdi “%s”." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "-elementet skal indeholde attributterne “uri” og “atime”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Ventede et -element, fik i stedet “%s”." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "-elementet mangler attributten “key” eller “value”." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "INS" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "OVR" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Skjul panel" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "Br_ug systemets skrifttype med fast bredde (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "_Skrifttype for redigering:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Skrifttype" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "Vis linje_numre" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Tabulatorbredde:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Indsæt _mellemrum i stedet for tabulatorer" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Glem, at du ikke bruger tabulatorstop" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Fremhæv aktuel _linje" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Fremhæv modsvarende _parenteser" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Fremhævning" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Gem automatisk filer" # Det skal nok ikke være for langt #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Tid i _minutter mellem autogem:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "Opret en _sikkerhedskopi af filer, før de gemmes" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Filer" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Følg systemets stil" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Lys stil" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Mørk stil" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Temavariant" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Vis højre _margen ved kolonne:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Vis _statuslinje" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Indstillinger" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Vil du virkelig nulstille alle indstillinger?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Nulstil alle" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Nulstil alle …" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Nulstil alle indstillinger" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Tegn tabulatorer" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Tegn mellemrum" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Tegn linjeskift" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Foranstillede mellemrum" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Mellemrum i tekst" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Efterstillede mellemrum" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tabulator" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Mellemrum" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Hårdt mellemrum" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Smalt hårdt mellemrum" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Resultat" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Information" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Når tegning af blanktegn er aktiveret, så tegnes ikkeombrydende mellemrum " "altid på alle placeringer, for at skelne dem fra normale mellemrum." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Farveskema for mørkt tema-variant" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Farveskema for lyst tema-variant" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Understøttes ikke for mørkt tema-variant" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Understøttes ikke for lyst tema-variant" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Placering:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Luk fil" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Fejl under indlæsning af filen." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Der opstod en fejl, da filen blev gemt." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Gem fil" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Åbn fil" #~ msgid "Unicode" #~ msgstr "Unicode" #~ msgid "Western" #~ msgstr "Vestlig" #~ msgid "Central European" #~ msgstr "Centraleuropæisk" #~ msgid "South European" #~ msgstr "Sydeuropæisk" #~ msgid "Baltic" #~ msgstr "Baltisk" #~ msgid "Cyrillic" #~ msgstr "Kyrillisk" #~ msgid "Arabic" #~ msgstr "Arabisk" #~ msgid "Greek" #~ msgstr "Græsk" #~ msgid "Hebrew Visual" #~ msgstr "Hebraisk (visuel)" #~ msgid "Turkish" #~ msgstr "Tyrkisk" #~ msgid "Nordic" #~ msgstr "Nordisk" #~ msgid "Celtic" #~ msgstr "Keltisk" #~ msgid "Romanian" #~ msgstr "Rumænsk" #~ msgid "Armenian" #~ msgstr "Armensk" #~ msgid "Chinese Traditional" #~ msgstr "Kinesisk (traditionel)" #~ msgid "Cyrillic/Russian" #~ msgstr "Kyrillisk/russisk" #~ msgid "Japanese" #~ msgstr "Japansk" #~ msgid "Korean" #~ msgstr "Koreansk" #~ msgid "Chinese Simplified" #~ msgstr "Kinesisk (forenklet)" #~ msgid "Georgian" #~ msgstr "Georgisk" #~ msgid "Hebrew" #~ msgstr "Hebraisk" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Kyrillisk/ukrainsk" #~ msgid "Vietnamese" #~ msgstr "Vietnamesisk" #~ msgid "Thai" #~ msgstr "Thai" #, c-format #~ msgid "%s (%s)" #~ msgstr "%s (%s)" #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'ISO-8859-1', 'UTF-16']" #~ msgid "Display _grid pattern" #~ msgstr "Vis gi_ttermønster" #, c-format #~ msgid "Untitled File %d" #~ msgstr "Unavngivet fil %d" #~ msgid "_Don’t Edit" #~ msgstr "Rediger _ikke" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/de.po000066400000000000000000000352621526404732400235720ustar00rootroot00000000000000# German translation for tepl. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # # Christian Kirbach , 2017. # Mario Blättermann , 2017. # Tim Sabsch , 2018. # Philipp Kiemle , 2021. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2021-02-27 18:23+0000\n" "PO-Revision-Date: 2021-03-18 15:39+0100\n" "Last-Translator: Philipp Kiemle \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.4.1\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Neu" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Neue Datei" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Neues _Fenster" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Ein neues Fenster öffnen" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "Ö_ffnen" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Eine Datei öffnen" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Speichern" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Aktuelle Datei speichern" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Speichern _unter" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Datei an einem anderen Ort speichern" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Rückgängig" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Letzte Aktion rückgängig machen" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Wiederholen" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Die letzte zurückgenommene Aktion wiederholen" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Ausschneiden" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Die Auswahl ausschneiden" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopieren" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Die Auswahl kopieren" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Einfügen" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Den Inhalt der Zwischenablage einfügen" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Löschen" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Ausgewählten Text löschen" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Alles au_swählen" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Den gesamten Text auswählen" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "Ein_rücken" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Die ausgewählten Zeilen einrücken" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "A_usrücken" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Die ausgewählten Zeilen ausrücken" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Gehe zu Zeile …" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Gehe zu einer spezifischen Zeile" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Schreibgeschützt" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Änderungen an der Datei »%s« vor dem Schließen speichern?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Ohne Speichern s_chließen" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-progress-info-bar.c:52 #: tepl/tepl-tab-saving.c:280 tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "A_bbrechen" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Speichern _unter …" #: tepl/tepl-file.c:445 #, c-format msgid "Untitled File %d" msgstr "Unbenannte Datei %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Der Inhalt muss mit UTF-8-Zeichenkodierung kodiert sein." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Gehe zu Zeile:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Schließen" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "_Trotzdem bearbeiten" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_Nicht bearbeiten" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Diese Datei »%s« ist bereits in einem anderen Fenster geöffnet." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Möchten Sie sie dennoch bearbeiten?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "_Trotzdem speichern" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Nicht speichern" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "" "Sicherungsdatei konnte während des Speicherns von »%s« nicht erstellt werden" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Es konnte keine Sicherung der alten Kopie der Datei erstellt werden, bevor " "die neue gespeichert wird. Sie können diese Warnung ignorieren und die Datei " "trotzdem speichern, aber bei einem Fehler während des Speichervorgangs " "könnte die alte Kopie der Datei verloren gehen. Trotzdem speichern?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Fehlermeldung: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "Die Datei »%s« wurde auf dem Datenträger geändert." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Änderungen verwerfen und _neu laden" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Neu laden" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Beim Speichern von »%s« wurden einige ungültige Zeichen gefunden." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Wenn Sie diese Datei speichern, könnten Sie das Dokument beschädigen. " "Trotzdem speichern?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Hervorhebungsmodus" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "A_uswählen" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Reiner Text" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "" "Die XML-Datei muss mit einem »«-Element beginnen, nicht mit »%s«." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "»«-Element erwartet, aber »%s« vorgefunden." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Der »atime«-Attributswert »%s« konnte nicht verarbeitet werden." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "" "Das »«-Element muss die Attribute »uri« und »atime« enthalten." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "»«-Element erwartet, aber »%s« vorgefunden." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Dem »»-Element fehlt das »key«- oder »value«-Attribut." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Leiste verbergen" #: tepl/tepl-space-drawer-prefs.c:189 tepl/tepl-space-drawer-prefs.c:191 #: tepl/tepl-space-drawer-prefs.c:193 msgid "Draw tabs" msgstr "Tabulatoren darstellen" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw spaces" msgstr "Leerzeichen darstellen" #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw new lines" msgstr "Neue Zeilen darstellen" #: tepl/tepl-space-drawer-prefs.c:231 msgid "Leading Spaces" msgstr "Führende Leerzeichen" #: tepl/tepl-space-drawer-prefs.c:235 msgid "Spaces Inside Text" msgstr "Leerzeichen im Text" #: tepl/tepl-space-drawer-prefs.c:239 msgid "Trailing Spaces" msgstr "Nachlaufende Leerzeichen" #: tepl/tepl-space-drawer-prefs.c:259 msgid "Tab" msgstr "Tabulator" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Space" msgstr "Leerzeichen" #: tepl/tepl-space-drawer-prefs.c:261 msgid "No-Break Space" msgstr "Geschütztes Leerzeichen" #: tepl/tepl-space-drawer-prefs.c:262 msgid "Narrow No-Break Space" msgstr "Schmales geschütztes Leerzeichen" #: tepl/tepl-space-drawer-prefs.c:281 msgid "Result" msgstr "Ergebnis" #: tepl/tepl-space-drawer-prefs.c:314 msgid "Information" msgstr "Information" #: tepl/tepl-space-drawer-prefs.c:316 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Wenn das Darstellen von Leerzeichen aktiviert ist, werden geschützte " "Leerzeichen an jeder Stelle dargestellt, um sie von regulären Leerzeichen zu " "unterscheiden." # Diese Abkürzungen finden sich auch in »gedit«. #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Z. %d, Sp. %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Ort:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Datei schließen" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Beim Laden der Datei trat ein Fehler auf." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Beim Speichern der Datei trat ein Fehler auf." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Datei speichern" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Datei öffnen" #~ msgid "Open “%s”" #~ msgstr "»%s« öffnen" #~ msgid "Open _Recent" #~ msgstr "Zu_letzt geöffnet" #~ msgid "Open a file recently used with %s" #~ msgstr "Eine kürzlich von »%s« verwendete Datei öffnen" #~ msgid "Unicode" #~ msgstr "Unicode" #~ msgid "Western" #~ msgstr "Westeuropäisch" #~ msgid "Central European" #~ msgstr "Mitteleuropäisch" #~ msgid "South European" #~ msgstr "Südeuropäisch" #~ msgid "Baltic" #~ msgstr "Baltisch" #~ msgid "Cyrillic" #~ msgstr "Kyrillisch" #~ msgid "Arabic" #~ msgstr "Arabisch" #~ msgid "Greek" #~ msgstr "Griechisch" #~ msgid "Hebrew Visual" #~ msgstr "Hebräisch (visuell)" #~ msgid "Turkish" #~ msgstr "Türkisch" #~ msgid "Nordic" #~ msgstr "Skandinavisch" #~ msgid "Celtic" #~ msgstr "Keltisch" #~ msgid "Romanian" #~ msgstr "Rumänisch" #~ msgid "Armenian" #~ msgstr "Armenisch" #~ msgid "Chinese Traditional" #~ msgstr "Chinesisch (traditionell)" #~ msgid "Cyrillic/Russian" #~ msgstr "Kyrillisch/Russisch" #~ msgid "Japanese" #~ msgstr "Japanisch" #~ msgid "Korean" #~ msgstr "Koreanisch" #~ msgid "Chinese Simplified" #~ msgstr "Chinesisch (vereinfacht)" #~ msgid "Georgian" #~ msgstr "Georgisch" #~ msgid "Hebrew" #~ msgstr "Hebräisch" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Kyrillisch/Ukrainisch" #~ msgid "Vietnamese" #~ msgstr "Vietnamesisch" #~ msgid "Thai" #~ msgstr "Thailändisch" #~ msgid "Unknown" #~ msgstr "Unbekannt" # translator-comments beachten. #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "Umwandlung von Zeichensatz »%s« in »%s« wird nicht unterstützt." #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "Konverter von »%s« in »%s« konnte nicht geöffnet werden: %s" #~ msgid "The input data contains an invalid sequence." #~ msgstr "Die EIngabedaten enthalten eine ungültige Folge." #~ msgid "Error when converting data: %s" #~ msgstr "Fehler beim Konvertieren der Daten: %s" #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "" #~ "Die Eingabedaten endenn mit einer unvollständigen Folge mehrerer Byte." #~ msgid "The input content ends with incomplete data." #~ msgstr "Die Eingabe endet mit unvollständigen Daten." #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "Die Datei ist zu groß. Es können höchstens %s geladen werden." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "Die Zeichenkodierung kann nicht automatisch erkannt werden." #~ msgid "The file is externally modified." #~ msgstr "Die Datei wurde extern verändert." #~ msgid "The buffer contains invalid characters." #~ msgstr "Zwischenspeicher enthält ungültige Zeichen." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/el.po000066400000000000000000000247651526404732400236100ustar00rootroot00000000000000# Greek translation for tepl. # Copyright (C) 2019 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Efstathios Iosifidis , 2019. # msgid "" msgstr "" "Project-Id-Version: tepl tepl-4-0\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2019-08-23 11:40+0000\n" "PO-Revision-Date: 2019-11-19 02:30+0200\n" "Last-Translator: Efstathios Iosifidis \n" "Language-Team: Greek \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 1.5.7\n" #. Translators: %s is a filename. #: amtk/amtk-application-window.c:374 #, c-format msgid "Open “%s”" msgstr "Άνοιγμα «%s»" #: amtk/amtk-application-window.c:630 msgid "Open _Recent" msgstr "" #. Translators: %s is the application name. #: amtk/amtk-application-window.c:633 #, c-format msgid "Open a file recently used with %s" msgstr "" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:92 msgid "_New" msgstr "_Νέο" #: tepl/tepl-application.c:93 msgid "New file" msgstr "Νέο αρχείο" #: tepl/tepl-application.c:95 msgid "New _Window" msgstr "Νέο _παράθυρο" #: tepl/tepl-application.c:96 msgid "Create a new window" msgstr "Δημιουργία νέου παραθύρου" #: tepl/tepl-application.c:98 tepl/tepl-application-window.c:178 msgid "_Open" msgstr "Ά_νοιγμα" #: tepl/tepl-application.c:99 msgid "Open a file" msgstr "Άνοιγμα αρχείου" #: tepl/tepl-application.c:101 tepl/tepl-close-confirm-dialog-single.c:144 #: tepl/tepl-tab.c:752 msgid "_Save" msgstr "_Αποθήκευση" #: tepl/tepl-application.c:102 msgid "Save the current file" msgstr "Αποθήκευση του τρέχοντος αρχείου" #: tepl/tepl-application.c:104 msgid "Save _As" msgstr "Αποθήκευση _ως" #: tepl/tepl-application.c:105 msgid "Save the current file to a different location" msgstr "Αποθήκευση του τρέχοντος αρχείου σε διαφορετική τοποθεσία" #. Edit menu #: tepl/tepl-application.c:109 msgid "_Undo" msgstr "_Αναίρεση" #: tepl/tepl-application.c:110 msgid "Undo the last action" msgstr "Αναίρεση της τελευταίας ενέργειας" #: tepl/tepl-application.c:112 msgid "_Redo" msgstr "_Επανάληψη" #: tepl/tepl-application.c:113 msgid "Redo the last undone action" msgstr "Επανάληψη της τελευταίας ενέργειας που αναιρέθηκε" #: tepl/tepl-application.c:115 msgid "Cu_t" msgstr "Απο_κοπή" #: tepl/tepl-application.c:116 msgid "Cut the selection" msgstr "Αποκοπή επιλογής" #: tepl/tepl-application.c:118 msgid "_Copy" msgstr "_Αντιγραφή" #: tepl/tepl-application.c:119 msgid "Copy the selection" msgstr "Αντιγραφή επιλογής" #: tepl/tepl-application.c:121 msgid "_Paste" msgstr "_Επικόλληση" #: tepl/tepl-application.c:122 msgid "Paste the clipboard" msgstr "Επικόλληση του πρόχειρου" #: tepl/tepl-application.c:124 msgid "_Delete" msgstr "_Διαγραφή" #: tepl/tepl-application.c:125 msgid "Delete the selected text" msgstr "Διαγραφή επιλεγμένου κειμένου" #: tepl/tepl-application.c:127 msgid "Select _All" msgstr "Επιλογή ό_λων" #: tepl/tepl-application.c:128 msgid "Select all the text" msgstr "Επιλογή όλου του κειμένου" #: tepl/tepl-application.c:130 msgid "_Indent" msgstr "" #: tepl/tepl-application.c:131 msgid "Indent the selected lines" msgstr "" #: tepl/tepl-application.c:133 msgid "_Unindent" msgstr "" #: tepl/tepl-application.c:134 msgid "Unindent the selected lines" msgstr "" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would screw up some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-application-window.c:174 msgid "Open File" msgstr "Άνοιγμα αρχείου" #: tepl/tepl-application-window.c:177 #: tepl/tepl-close-confirm-dialog-single.c:138 tepl/tepl-tab.c:751 msgid "_Cancel" msgstr "_Ακύρωση" #: tepl/tepl-application-window.c:708 msgid "Read-Only" msgstr "Μόνο για ανάγνωση" #: tepl/tepl-close-confirm-dialog-single.c:133 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "" #: tepl/tepl-close-confirm-dialog-single.c:137 msgid "Close _without Saving" msgstr "Κλείσιμο _χωρίς αποθήκευση" #: tepl/tepl-close-confirm-dialog-single.c:150 msgid "_Save As…" msgstr "_Αποθηκευση ως…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_get_all(). #. #: tepl/tepl-encoding.c:115 tepl/tepl-encoding.c:132 tepl/tepl-encoding.c:133 #: tepl/tepl-encoding.c:134 tepl/tepl-encoding.c:135 tepl/tepl-encoding.c:136 #: tepl/tepl-encoding.c:137 tepl/tepl-encoding.c:138 msgid "Unicode" msgstr "Unicode" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding.c:117 tepl/tepl-encoding.c:129 tepl/tepl-encoding.c:157 #: tepl/tepl-encoding.c:180 msgid "Western" msgstr "" #: tepl/tepl-encoding.c:118 tepl/tepl-encoding.c:158 tepl/tepl-encoding.c:178 msgid "Central European" msgstr "" #: tepl/tepl-encoding.c:119 msgid "South European" msgstr "" #: tepl/tepl-encoding.c:120 tepl/tepl-encoding.c:127 tepl/tepl-encoding.c:185 msgid "Baltic" msgstr "" #: tepl/tepl-encoding.c:121 tepl/tepl-encoding.c:159 tepl/tepl-encoding.c:166 #: tepl/tepl-encoding.c:168 tepl/tepl-encoding.c:169 tepl/tepl-encoding.c:179 msgid "Cyrillic" msgstr "Κυριλλικά" #: tepl/tepl-encoding.c:122 tepl/tepl-encoding.c:162 tepl/tepl-encoding.c:184 msgid "Arabic" msgstr "Αραβικά" #: tepl/tepl-encoding.c:123 tepl/tepl-encoding.c:181 msgid "Greek" msgstr "Ελληνικά" #: tepl/tepl-encoding.c:124 msgid "Hebrew Visual" msgstr "" #: tepl/tepl-encoding.c:125 tepl/tepl-encoding.c:160 tepl/tepl-encoding.c:182 msgid "Turkish" msgstr "Τούρκικα" #: tepl/tepl-encoding.c:126 msgid "Nordic" msgstr "" #: tepl/tepl-encoding.c:128 msgid "Celtic" msgstr "Κέλτικα" #: tepl/tepl-encoding.c:130 msgid "Romanian" msgstr "" #: tepl/tepl-encoding.c:140 msgid "Armenian" msgstr "Αρμένικα" #: tepl/tepl-encoding.c:141 tepl/tepl-encoding.c:142 tepl/tepl-encoding.c:150 msgid "Chinese Traditional" msgstr "Κινέζικα Παραδοσιακά" #: tepl/tepl-encoding.c:143 msgid "Cyrillic/Russian" msgstr "" #: tepl/tepl-encoding.c:145 tepl/tepl-encoding.c:146 tepl/tepl-encoding.c:147 #: tepl/tepl-encoding.c:164 tepl/tepl-encoding.c:172 msgid "Japanese" msgstr "Ιαπωνικά" #: tepl/tepl-encoding.c:149 tepl/tepl-encoding.c:165 tepl/tepl-encoding.c:167 #: tepl/tepl-encoding.c:175 msgid "Korean" msgstr "Κορεάτικα" #: tepl/tepl-encoding.c:152 tepl/tepl-encoding.c:153 tepl/tepl-encoding.c:154 msgid "Chinese Simplified" msgstr "" #: tepl/tepl-encoding.c:155 msgid "Georgian" msgstr "" #: tepl/tepl-encoding.c:161 tepl/tepl-encoding.c:183 msgid "Hebrew" msgstr "Εβραϊκά" #: tepl/tepl-encoding.c:170 msgid "Cyrillic/Ukrainian" msgstr "" #: tepl/tepl-encoding.c:173 tepl/tepl-encoding.c:176 tepl/tepl-encoding.c:186 msgid "Vietnamese" msgstr "Βιετναμέζικα" #: tepl/tepl-encoding.c:174 msgid "Thai" msgstr "Ταϋλανδέζικα" #: tepl/tepl-encoding.c:370 msgid "Unknown" msgstr "" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding.c:695 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "" #: tepl/tepl-encoding-converter.c:302 #, c-format msgid "Conversion from character set “%s” to “%s” is not supported." msgstr "" #: tepl/tepl-encoding-converter.c:311 #, c-format msgid "Could not open converter from “%s” to “%s”: %s" msgstr "" #: tepl/tepl-encoding-converter.c:368 msgid "The input data contains an invalid sequence." msgstr "" #: tepl/tepl-encoding-converter.c:377 #, c-format msgid "Error when converting data: %s" msgstr "Σφάλμα κατά την μετατροπή δεδομένων: %s" #: tepl/tepl-encoding-converter.c:556 msgid "The input data ends with an incomplete multi-byte sequence." msgstr "" #: tepl/tepl-encoding-converter.c:579 msgid "The input content ends with incomplete data." msgstr "" #: tepl/tepl-file.c:413 #, c-format msgid "Untitled File %d" msgstr "Αρχείο χωρίς τίτλο %d" #: tepl/tepl-file-content-loader.c:331 #, c-format msgid "The file is too big. Maximum %s can be loaded." msgstr "" #: tepl/tepl-file-loader.c:872 msgid "It is not possible to detect the character encoding automatically." msgstr "" #: tepl/tepl-file-saver.c:784 msgid "The file is externally modified." msgstr "Το αρχείο έχει τροποποιηθεί εξωτερικά." #: tepl/tepl-file-saver.c:1318 msgid "The buffer contains invalid characters." msgstr "" #: tepl/tepl-tab.c:534 msgid "Error when loading the file." msgstr "Σφάλμα κατά την φόρτωση αρχείου." #: tepl/tepl-tab.c:748 msgid "Save File" msgstr "Αποθήκευση αρχείου" #. Translators: location of a file. #: tepl/tepl-tab-label.c:273 msgid "Location:" msgstr "Τοποθεσία:" #: tepl/tepl-tab-label.c:342 msgid "Close file" msgstr "Κλείσιμο αρχείου" #: tepl/tepl-tab-saving.c:64 msgid "Error when saving the file." msgstr "Σφάλμα κατά την αποθήκευση αρχείου." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/en_GB.po000066400000000000000000000330001526404732400241400ustar00rootroot00000000000000# British English translation for tepl. # Copyright (C) 2020 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Zander Brown , 2020-2021. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-11-05 22:45+0000\n" "PO-Revision-Date: 2021-03-30 00:32+0100\n" "Last-Translator: Zander Brown \n" "Language-Team: English - United Kingdom \n" "Language: en_GB\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Gtranslator 3.38.0\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_New" #: tepl/tepl-application.c:80 msgid "New file" msgstr "New file" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "New _Window" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Create a new window" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Open" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Open a file" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Save" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Save the current file" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Save _As" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Save the current file to a different location" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Undo" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Undo the last action" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Redo" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Redo the last undone action" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Cu_t" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Cut the selection" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Copy" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Copy the selection" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Paste" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Paste the clipboard" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Delete" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Delete the selected text" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Select _All" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Select all the text" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Indent" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Indent the selected lines" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Unindent" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Unindent the selected lines" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Go to Line…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Go to a specific line" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Read-Only" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Save changes to file “%s” before closing?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Close _without Saving" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:120 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Cancel" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Save As…" #: tepl/tepl-file.c:426 #, c-format msgid "Untitled File %d" msgstr "Untitled File %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "The content must use UTF-8 character encoding." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Go to line:" #: tepl/tepl-goto-line-bar.c:243 #| msgid "Close file" msgid "Close" msgstr "Close" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "_Edit Anyway" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_Don’t Edit" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "This file “%s” is already open in another window." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Do you want to edit it anyway?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 #| msgid "Save _As" msgid "S_ave Anyway" msgstr "S_ave Anyway" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Don’t Save" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "Could not create a backup file while saving “%s”" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Could not create a backup copy of the file before saving. You can ignore " "this warning and save the file anyway, but if an error occurs while saving, " "you could lose the old copy of the file. Save anyway?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Error message: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "The file “%s” changed on disk." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Drop Changes and _Reload" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Reload" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Some invalid characters where been detected while saving “%s”." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "If you continue saving this file you may corrupt it. Save anyway?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:115 msgid "Highlight Mode" msgstr "Highlight Mode" #: tepl/tepl-language-chooser-dialog.c:121 #| msgid "Select _All" msgid "_Select" msgstr "_Select" #: tepl/tepl-language-chooser-widget.c:71 msgid "Plain Text" msgstr "Plain Text" #: tepl/tepl-language-chooser-widget.c:441 msgid "Search highlight mode…" msgstr "Search highlight mode…" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "The XML file must start with a element, not “%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Expected a element, got “%s” instead." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Failed to parse the “atime” attribute value “%s”." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "The element must contain the “uri” and “atime” attributes." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Expected an element, got “%s” instead." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "The element is missing the “key” or “value” attribute." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Hide panel" #: tepl/tepl-space-drawer-prefs.c:189 tepl/tepl-space-drawer-prefs.c:191 #: tepl/tepl-space-drawer-prefs.c:193 msgid "Draw tabs" msgstr "Draw tabs" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw spaces" msgstr "Draw spaces" #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw new lines" msgstr "Draw new lines" #: tepl/tepl-space-drawer-prefs.c:231 msgid "Leading Spaces" msgstr "Leading Spaces" #: tepl/tepl-space-drawer-prefs.c:235 msgid "Spaces Inside Text" msgstr "Spaces Inside Text" #: tepl/tepl-space-drawer-prefs.c:239 msgid "Trailing Spaces" msgstr "Trailing Spaces" #: tepl/tepl-space-drawer-prefs.c:259 msgid "Tab" msgstr "Tab" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Space" msgstr "Space" #: tepl/tepl-space-drawer-prefs.c:261 msgid "No-Break Space" msgstr "No-Break Space" #: tepl/tepl-space-drawer-prefs.c:262 msgid "Narrow No-Break Space" msgstr "Narrow No-Break Space" #: tepl/tepl-space-drawer-prefs.c:281 msgid "Result" msgstr "Result" #: tepl/tepl-space-drawer-prefs.c:314 #| msgid "Location:" msgid "Information" msgstr "Information" #: tepl/tepl-space-drawer-prefs.c:316 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Ln %d, Col %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Location:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Close file" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Error when loading the file." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Error when saving the file." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Save File" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Open File" #~ msgid "Unicode" #~ msgstr "Unicode" #~ msgid "Western" #~ msgstr "Western" #~ msgid "Central European" #~ msgstr "Central European" #~ msgid "South European" #~ msgstr "South European" #~ msgid "Baltic" #~ msgstr "Baltic" #~ msgid "Cyrillic" #~ msgstr "Cyrillic" #~ msgid "Arabic" #~ msgstr "Arabic" #~ msgid "Greek" #~ msgstr "Greek" #~ msgid "Hebrew Visual" #~ msgstr "Hebrew Visual" #~ msgid "Turkish" #~ msgstr "Turkish" #~ msgid "Nordic" #~ msgstr "Nordic" #~ msgid "Celtic" #~ msgstr "Celtic" #~ msgid "Romanian" #~ msgstr "Romanian" #~ msgid "Armenian" #~ msgstr "Armenian" #~ msgid "Chinese Traditional" #~ msgstr "Chinese Traditional" #~ msgid "Cyrillic/Russian" #~ msgstr "Cyrillic/Russian" #~ msgid "Japanese" #~ msgstr "Japanese" #~ msgid "Korean" #~ msgstr "Korean" #~ msgid "Chinese Simplified" #~ msgstr "Chinese Simplified" #~ msgid "Georgian" #~ msgstr "Georgian" #~ msgid "Hebrew" #~ msgstr "Hebrew" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Cyrillic/Ukrainian" #~ msgid "Vietnamese" #~ msgstr "Vietnamese" #~ msgid "Thai" #~ msgstr "Thai" #~ msgid "Unknown" #~ msgstr "Unknown" #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "Conversion from character set “%s” to “%s” is not supported." #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "Could not open converter from “%s” to “%s”: %s" #~ msgid "The input data contains an invalid sequence." #~ msgstr "The input data contains an invalid sequence." #~ msgid "Error when converting data: %s" #~ msgstr "Error when converting data: %s" #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "The input data ends with an incomplete multi-byte sequence." #~ msgid "The input content ends with incomplete data." #~ msgstr "The input content ends with incomplete data." #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "The file is too big. Maximum %s can be loaded." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "It is not possible to detect the character encoding automatically." #~ msgid "The file is externally modified." #~ msgstr "The file is externally modified." #~ msgid "The buffer contains invalid characters." #~ msgstr "The buffer contains invalid characters." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/es.po000066400000000000000000000344651526404732400236150ustar00rootroot00000000000000# Spanish translation for tepl. # Copyright (C) 2017 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Daniel Mustieles , 2017-2021. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2021-01-13 12:57+0000\n" "PO-Revision-Date: 2021-02-16 16:45+0100\n" "Last-Translator: Daniel Mustieles \n" "Language-Team: Spanish - Spain \n" "Language: es_ES\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Gtranslator 3.38.0\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nuevo" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Archivo nuevo" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "_Ventana nueva" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Crear una ventana nueva" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "Ab_rir" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Abrir un archivo" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Guardar" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Guardar el archivo actual" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Guardar _como" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Guarda el archivo actual en un lugar diferente" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "Des_hacer" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Deshace la última acción" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Rehacer" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Rehacer la última acción deshecha" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "C_ortar" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Cortar la selección" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Copiar" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Copiar la selección" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Pegar" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Pegar del portapapeles" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Eliminar" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Eliminar el texto seleccionado" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Seleccionar _todo" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Seleccionar todo el texto" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Sangrar" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Sangrar las líneas seleccionadas" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "Qui_tar sangrado" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Quitar sangrado de las líneas seleccionadas" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Ir a la línea…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Ir a una línea específica" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Sólo lectura" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "¿Quiere guardar los cambios en el archivo «%s» antes de cerrar?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Cerrar _sin guardar" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-progress-info-bar.c:52 #: tepl/tepl-tab-saving.c:280 tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Cancelar" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Guardar _como…" #: tepl/tepl-file.c:445 #, c-format msgid "Untitled File %d" msgstr "Archivo sin título %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "El contenido se debe codificar con UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Ir a la línea:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Cerrar" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "_Editar de todas formas" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_No editar" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Este archivo «%s» ya está abierto en otra ventana." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "¿Quiere editarlo de todas formas?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "Gu_ardar de todos modos" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_No guardar" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "No se pudo crear un archivo de respaldo al guardar «%s»" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "No se pudo respaldar la copia anterior del archivo ante de guardar el nuevo. " "Puede ignorar esta advertencia y guardar el archivo de todos modos, pero si " "ocurre un error al guardar perderá la copia anterior del archivo. ¿Quiere " "guardar de todas formas?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Mensaje de error: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "El archivo «%s» ha cambiado en el disco." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Descartar cambios y _recargar" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Recargar" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Se han detectado algunos caracteres no válidos al guardar «%s»." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Si continúa guardando el documento puede que llegue a corromperlo. ¿Quiere " "guardarlo de todas formas?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Modo de resaltado" #: tepl/tepl-language-chooser-dialog.c:131 #| msgid "Select _All" msgid "_Select" msgstr "_Seleccionar" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Texto plano" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Modo de resaltado de la búsqueda…" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "El archivo XML debe empezar con un elemento , no con «%s»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Se esperaba un elemento , se obtuvo «%s» en su lugar." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Falló al analizar el atributo «atime» del valor «%s»." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "El elemento debe contener los atributos «uri» y «atime»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Se esperaba un elemento , se obtuvo «%s» en su lugar." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "El elemento debe contener los atributos «key» o «value»." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Ocultar panel" #: tepl/tepl-space-drawer-prefs.c:189 tepl/tepl-space-drawer-prefs.c:191 #: tepl/tepl-space-drawer-prefs.c:193 msgid "Draw tabs" msgstr "Dibujar tabulaciones" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw spaces" msgstr "Dibujar espacios" #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw new lines" msgstr "Dibujar líneas nuevas" #: tepl/tepl-space-drawer-prefs.c:231 msgid "Leading Spaces" msgstr "Espacios al principio" #: tepl/tepl-space-drawer-prefs.c:235 msgid "Spaces Inside Text" msgstr "Espacios en el texto" #: tepl/tepl-space-drawer-prefs.c:239 msgid "Trailing Spaces" msgstr "Espacios al final" #: tepl/tepl-space-drawer-prefs.c:259 msgid "Tab" msgstr "Tabulación" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Space" msgstr "Espacio" #: tepl/tepl-space-drawer-prefs.c:261 msgid "No-Break Space" msgstr "Espacio no disruptivo" #: tepl/tepl-space-drawer-prefs.c:262 msgid "Narrow No-Break Space" msgstr "Espacio no disruptivo estrecho" #: tepl/tepl-space-drawer-prefs.c:281 msgid "Result" msgstr "Resultado" #: tepl/tepl-space-drawer-prefs.c:314 msgid "Information" msgstr "Información" #: tepl/tepl-space-drawer-prefs.c:316 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Cuando el dibujado de espacios en blanco está activado, los espacios no " "disruptivos se dibujan siempre en todas las ubicaciones, para distinguirlos " "de los espacios normales." #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Ln %d, Col %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Ubicación:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Cerrar archivo" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Error al cargar el archivo." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Error al guardar el archivo." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Guardar archivo" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Abrir archivo" #~ msgid "Unicode" #~ msgstr "Unicode" #~ msgid "Western" #~ msgstr "Occidental" #~ msgid "Central European" #~ msgstr "Europa central" #~ msgid "South European" #~ msgstr "Europa del sur" #~ msgid "Baltic" #~ msgstr "Báltico" #~ msgid "Cyrillic" #~ msgstr "Cirílico" #~ msgid "Arabic" #~ msgstr "Árabe" #~ msgid "Greek" #~ msgstr "Griego" #~ msgid "Hebrew Visual" #~ msgstr "Hebreo visual" #~ msgid "Turkish" #~ msgstr "Turco" #~ msgid "Nordic" #~ msgstr "Nórdico" #~ msgid "Celtic" #~ msgstr "Celta" #~ msgid "Romanian" #~ msgstr "Rumano" #~ msgid "Armenian" #~ msgstr "Armenio" #~ msgid "Chinese Traditional" #~ msgstr "Chino tradicional" #~ msgid "Cyrillic/Russian" #~ msgstr "Cirílico/Ruso" #~ msgid "Japanese" #~ msgstr "Japones" #~ msgid "Korean" #~ msgstr "Coreano" #~ msgid "Chinese Simplified" #~ msgstr "Chino simplificado" #~ msgid "Georgian" #~ msgstr "Georgiano" #~ msgid "Hebrew" #~ msgstr "Hebreo" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Cirílico/Ucraniano" #~ msgid "Vietnamese" #~ msgstr "Vietnamita" #~ msgid "Thai" #~ msgstr "Tailandés" #~ msgid "Unknown" #~ msgstr "Desconocido" #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "" #~ "La conversión desde el conjunto de caracteres «%s» a «%s» no está " #~ "soportada." #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "No se pudo abrir el conversor de «%s» a «%s»: %s" #~ msgid "The input data contains an invalid sequence." #~ msgstr "Los datos de entrada contienen una secuencia no válida." #~ msgid "Error when converting data: %s" #~ msgstr "Error al convertir los datos: %s" #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "" #~ "Los datos de entrada terminan con una secuencia de varios bytes " #~ "incompleta." #~ msgid "The input content ends with incomplete data." #~ msgstr "El contenido de la entrada termina con datos incompletos." #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "" #~ "El archivo es demasiado grande. Sólo se puede cargar un máximo de %s." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "" #~ "No es posible detectar la codificación de caracteres automáticamente." #~ msgid "The file is externally modified." #~ msgstr "El archivo se ha modificado externamente." #~ msgid "The buffer contains invalid characters." #~ msgstr "El búfer contiene caracteres no válidos." #~ msgid "Open “%s”" #~ msgstr "Abrir «%s»" #~ msgid "Open _Recent" #~ msgstr "Abir _reciente" #~ msgid "Open a file recently used with %s" #~ msgstr "Abrir un archivo usado recientemente con %s" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/eu.po000066400000000000000000000444571526404732400236210ustar00rootroot00000000000000# Basque translation for tepl. # Copyright (C) 2019 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Asier Saratsua Garmendia , 2019, 2020, 2026. # msgid "" msgstr "Project-Id-Version: tepl tepl-4-0\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/issues\n" "POT-Creation-Date: 2025-10-31 08:49+0000\n" "PO-Revision-Date: 2026-08-23 10:00+0100\n" "Last-Translator: Asier Saratsua Garmendia \n" "Language-Team: Basque \n" "Language: eu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Berria" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Fitxategi berria" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Leiho _berria" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Sortu leiho berria" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Ireki" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Ireki fitxategia" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Gorde" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Uneko fitxategia gordetzen du" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Gorde _honela" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Gorde uneko fitxategia beste kokaleku batean" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Desegin" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Desegin azken ekintza" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Berregin" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Desegin den azken ekintza berregiten du" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Ebaki" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Ebaki hautapena" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopiatu" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopiatu hautapena" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Itsatsi" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Arbelaren edukia itsasten du" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "Ez_abatu" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Ezabatu hautatutako testua" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Hautatu _dena" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Hautatu testu osoa" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Koskatu" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Koskatu hautatutako lerroak" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "K_endu koska" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Kendu hautatutako lerroen koska" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "Joan _lerrora…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Joan lerro zehatzera" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Irakurtzeko soilik" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Gorde aldaketak “%s” fitxategian itxi baino lehen?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Itxi gorde _gabe" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Utzi" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Gorde _honela…" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Joan lerrora:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Itxi" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "%s fitxategia jadanik irekita dago beste %s leiho batean." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "%s aplikazioak modu ez editagarrian ireki du fitxategiaren instantzia hau. Hala ere, fitxategia editatu nahi duzu?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Editatu dena den" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Mantendu irakurtzeko moduan" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Ezin izan da babeskopiarik sortu “%s” gordetzean." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "Ezin izan da fitxategiaren kopia zaharraren babeskopiarik egin berria gorde baino lehen. Abisu honi ez ikusiarena egin diezaiokezu eta fitxategia gorde dena den, baina gordetzean errore bat gertatzen bada, fitxategiaren kopia zaharra galdu dezakezu. Gorde dena den?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Errore-mezua: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Gorde dena den" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "E_z gorde" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "“%s” fitxategia diskoan aldatu da." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "Dokumentu honek gorde gabeko aldaketak ditu. Aldaketak baztertu eta fitxategia birkargatu nahi duzu?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Fitxategia birkargatu nahi duzu?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Jaregin aldaketak eta bir_kargatu" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "Bir_kargatu" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Ez ikusi egin" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "“%s” fitxategia kanpoan aldatu da." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "Gordetzen baduzu, kanpoko aldaketak galdu egingo dira. Gorde dena den?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Baliogabeko karaktere batzuk hauteman dira “%s” gordetzean." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "Fitxategi hau gordetzen jarraitzen baduzu, dokumentua honda dezakezu. Gorde dena den?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Nabarmentze-modua" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Hautatu" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Testu soila" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Bilaketaren nabarmentze-modua…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "%d lerroa, %d zutabea" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML fitxategia elementuarekin hasi behar da, ez “%s” elementuarekin." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr " elementua espero zen, “%s” eskuratu da horren ordez." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Huts egin du “atime” atributuaren “%s” balioa analizatzeak." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr " elementuak “uri” eta “atime” atributuak eduki behar ditu." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr " elementua espero zen, “%s” eskuratu da horren ordez." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr " elementuari “key” edo “value” atributua falta zaio." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "TXER" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "GAIN" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Ezkutatu panela" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Erabili sistemaren letra-zabalera (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "Editorearen _letra-tipoa:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Letra-tipoa" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "Bistaratu _lerro-zenbakiak" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Tabuladore-zabalera:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Txertatu _zuriuneak tabuladoreen ordez" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "A_haztu tabulazioak ez zarela erabiltzen ari" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Nabarmendu uneko _lerroa" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Nabarmendu bat datozen _parentesiak" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Nabarmentzea" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "Gorde fitxategiak _automatikoki" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Gordetze automatikoen arteko tartea _minututan:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "Sortu fitxategien _babeskopia gorde baino lehen" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Fitxategiak" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Jarraitu sistemaren estiloa" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Estilo argia" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Estilo iluna" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Gai-aldaera" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Bistaratu eskuineko _marjina zutabean:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Bistaratu eg_oera-barra" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Hobespenak" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Hobespen guztiak berrezarri nahi dituzu?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Berrezarri denak" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Berrezarri denak…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Berrezarri hobespen guztiak" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Marraztu tabuladoreak" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Marraztu zuriuneak" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Marraztu lerro berriak" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Hasierako zuriuneak" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Testuaren barruko zuriuneak" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Amaierako zuriuneak" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tab" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Zuriunea" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Zuriune zatiezina" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Zuriune zatiezin estua" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Emaitza" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Informazioa" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "Zuriuneak marraztea gaituta dagoenean, zuriune zatiezinak beti marrazten dira, kokaleku guztietan, zuriune normaletatik bereizteko." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Kolore-eskema gai ilunean" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Kolore-eskema gai argian" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Ez da onartzen gai ilunerako" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Ez da onartzen gai argirako" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Kokalekua:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Itxi fitxategia" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Errorea fitxategia kargatzean." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Errorea fitxategia gordetzean." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Gorde fitxategia" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Ireki fitxategia" #, c-format #~ msgid "Untitled File %d" #~ msgstr "Izenik gabeko %d fitxategia" #~ msgid "The content must be encoded with the UTF-8 character encoding." #~ msgstr "Edukiak UTF-8 karaktere-kodeketarekin kodetuta egon behar du." #~ msgid "_Don’t Edit" #~ msgstr "E_z editatu" #~ msgid "Open “%s”" #~ msgstr "Ireki “%s”" #~ msgid "Open _Recent" #~ msgstr "A_zken fitxategiak" #~ msgid "Open a file recently used with %s" #~ msgstr "Ireki erabili berri duzun fitxategia %s bidez" #~ msgid "Unicode" #~ msgstr "Unicode" #~ msgid "Western" #~ msgstr "Mendebalekoa" #~ msgid "Central European" #~ msgstr "Europako Erdialdekoa" #~ msgid "South European" #~ msgstr "Europako Hegoaldekoa" #~ msgid "Baltic" #~ msgstr "Baltikoa" #~ msgid "Cyrillic" #~ msgstr "Zirilikoa" #~ msgid "Arabic" #~ msgstr "Arabiera" #~ msgid "Greek" #~ msgstr "Greziera" #~ msgid "Hebrew Visual" #~ msgstr "Hebrear bisuala" #~ msgid "Turkish" #~ msgstr "Turkiera" #~ msgid "Nordic" #~ msgstr "Nordikoa" #~ msgid "Celtic" #~ msgstr "Zeltiarra" #~ msgid "Romanian" #~ msgstr "Errumaniera" #~ msgid "Armenian" #~ msgstr "Armeniera" #~ msgid "Chinese Traditional" #~ msgstr "Txinera tradizionala" #~ msgid "Cyrillic/Russian" #~ msgstr "Zirilikoa/Errusiarra" #~ msgid "Japanese" #~ msgstr "Japoniera" #~ msgid "Korean" #~ msgstr "Koreera" #~ msgid "Chinese Simplified" #~ msgstr "Txinatar soildua" #~ msgid "Georgian" #~ msgstr "Georgiera" #~ msgid "Hebrew" #~ msgstr "Hebreera" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Zirilikoa/Ukrainarra" #~ msgid "Vietnamese" #~ msgstr "Vietnamera" #~ msgid "Thai" #~ msgstr "Thailandiera" #~ msgid "Unknown" #~ msgstr "Ezezaguna" #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "“%s” karaktere-multzoa “%s” bihurtzea ez da onartzen." #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "Ezin izan da “%s”(e)tik “%s”(e)rako bihurtzailea ireki: %s" #~ msgid "The input data contains an invalid sequence." #~ msgstr "Sarrerako datuek baliogabeko sekuentzia bat dute." #~ msgid "Error when converting data: %s" #~ msgstr "Errorea datuak bihurtzean: %s" #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "" #~ "Sarrerako datuak osatu gabeko byte anitzeko sekuentzia batekin amaitzen " #~ "da." #~ msgid "The input content ends with incomplete data." #~ msgstr "Sarrerako edukia osatu gabeko datuekin amaitzen da." #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "Fitxategia handiegia da. Gehienez %s kargatu daiteke." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "Ezin da karaktere-kodeketa automatikoki atzeman." #~ msgid "The buffer contains invalid characters." #~ msgstr "Bufferrak baliogabeko karaktereak ditu." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/fr.po000066400000000000000000000236401526404732400236060ustar00rootroot00000000000000# French translation for tepl. # Copyright (C) 2021 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Thibault Leclair , 2021. # msgid "" msgstr "" "Project-Id-Version: tepl tepl-5-0\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2021-02-27 18:23+0000\n" "PO-Revision-Date: 2021-03-30 18:24+0200\n" "Last-Translator: Thibault Leclair \n" "Language-Team: GNOME French Team \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Gtranslator 3.38.0\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nouveau" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Nouveau fichier" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Nouvelle _fenêtre" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Créer une nouvelle fenêtre" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Ouvrir" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Ouvrir un fichier" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Enregistrer" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Enregistrer le fichier actuel" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Enregistrer _sous" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Enregistrer le fichier actuel dans un emplacement différent" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "Ann_uler" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Annuler la dernière action" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Rétablir" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Rétablir la dernière action annulée" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Co_uper" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Couper la sélection" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Copier" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Copier la sélection" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "C_oller" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Coller le contenu du presse-papiers" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Supprimer" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Supprimer le texte sélectionné" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Tout _sélectionner" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Sélectionner tout le texte" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Indenter" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Indenter les lignes sélectionnées" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Désindenter" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Désindenter les lignes sélectionnées" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Aller à la ligne…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Aller à une ligne spécifiée" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Lecture seule" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "" "Voulez-vous enregistrer les modifications du fichier « %s » avant de le " "fermer ?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "_Fermer sans enregistrer" #: tepl/tepl-close-confirm-dialog-single.c:131 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "A_nnuler" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Enregistrer _sous…" #: tepl/tepl-file.c:426 #, c-format msgid "Untitled File %d" msgstr "Fichier sans nom %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Le contenu doit être codé avec le codage de caractères UTF-8." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Aller à la ligne :" #: tepl/tepl-goto-line-bar.c:243 msgid "Close" msgstr "Fermer" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "_Ouvrir malgré tout" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_Ne pas ouvrir" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Ce fichier « %s » est déjà ouvert dans une autre fenêtre." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Voulez-vous l’ouvrir quand même ?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "_Enregistrer quand même" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Ne pas enregistrer" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "" "Impossible de créer un fichier de sauvegarde lors de l’enregistrement de " "« %s »" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Impossible de sauvegarder l’ancienne copie du fichier avant d’enregistrer le " "nouveau. Vous pouvez ignorer cet avertissement et enregistrer le fichier " "malgré tout, mais si une erreur se produit lors de l’enregistrement, vous " "pouvez perdre l’ancienne copie du fichier. Enregistrer quand même ?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Message d’erreur : %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "Le fichier « %s » a été modifié sur le disque." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Ignorer les _modifications et recharger" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Recharger" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "" "Des caractères non valides ont été détectés lors de l’enregistrement de " "« %s »." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Si vous continuez à enregistrer ce fichier, vous pouvez endommager le " "document. Enregistrer quand même ?" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "" "Le fichier XML doit commencer par un élément et non par « %s »." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Un élément était attendu, « %s » obtenu à la place." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Échec de l’analyse de la valeur d’attribut « atime » « %s »." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "L’élément doit contenir les attributs « uri » et « atime »." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Un élément était attendu, « %s » obtenu à la place." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "L’élément ne possède pas l’attribut « key » ou « value »." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Masquer le panneau" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Lig %d, Col %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Emplacement :" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Fermer le fichier" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Erreur lors du chargement du fichier." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Erreur lors de l’enregistrement du fichier." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Enregistrer le fichier" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Ouvrir un fichier" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/fur.po000066400000000000000000000142411526404732400237700ustar00rootroot00000000000000# Friulian translation for tepl. # Copyright (C) 2017 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Fabio Tomat , 2017. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-04-03 05:53+0000\n" "PO-Revision-Date: 2017-04-08 20:42+0200\n" "Language-Team: Friulian \n" "Language: fur\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Last-Translator: Fabio Tomat \n" "X-Generator: Poedit 1.8.12\n" #. Translators: %s is a filename. #: tepl/tepl-application-window.c:356 #, c-format msgid "Open “%s”" msgstr "Vierç “%s”" #: tepl/tepl-application-window.c:575 msgid "Open _Recent" msgstr "Vierç _resint" #. Translators: %s is the application name. #: tepl/tepl-application-window.c:578 #, c-format msgid "Open a file recently used with %s" msgstr "Vierç un file doprât di resint cun %s" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_get_all(). #. #: tepl/tepl-encoding.c:115 tepl/tepl-encoding.c:132 tepl/tepl-encoding.c:133 #: tepl/tepl-encoding.c:134 tepl/tepl-encoding.c:135 tepl/tepl-encoding.c:136 #: tepl/tepl-encoding.c:137 tepl/tepl-encoding.c:138 msgid "Unicode" msgstr "Unicode" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding.c:117 tepl/tepl-encoding.c:129 tepl/tepl-encoding.c:157 #: tepl/tepl-encoding.c:180 msgid "Western" msgstr "Ocidentâl" #: tepl/tepl-encoding.c:118 tepl/tepl-encoding.c:158 tepl/tepl-encoding.c:178 msgid "Central European" msgstr "European centrâl" #: tepl/tepl-encoding.c:119 msgid "South European" msgstr "European dal sud" #: tepl/tepl-encoding.c:120 tepl/tepl-encoding.c:127 tepl/tepl-encoding.c:185 msgid "Baltic" msgstr "Baltic" #: tepl/tepl-encoding.c:121 tepl/tepl-encoding.c:159 tepl/tepl-encoding.c:166 #: tepl/tepl-encoding.c:168 tepl/tepl-encoding.c:169 tepl/tepl-encoding.c:179 msgid "Cyrillic" msgstr "Cirilic" #: tepl/tepl-encoding.c:122 tepl/tepl-encoding.c:162 tepl/tepl-encoding.c:184 msgid "Arabic" msgstr "Arap" #: tepl/tepl-encoding.c:123 tepl/tepl-encoding.c:181 msgid "Greek" msgstr "Grêc" #: tepl/tepl-encoding.c:124 msgid "Hebrew Visual" msgstr "Ebraic Visuâl" #: tepl/tepl-encoding.c:125 tepl/tepl-encoding.c:160 tepl/tepl-encoding.c:182 msgid "Turkish" msgstr "Turc" #: tepl/tepl-encoding.c:126 msgid "Nordic" msgstr "Nordic" #: tepl/tepl-encoding.c:128 msgid "Celtic" msgstr "Celtic" #: tepl/tepl-encoding.c:130 msgid "Romanian" msgstr "Rumen" #: tepl/tepl-encoding.c:140 msgid "Armenian" msgstr "Armen" #: tepl/tepl-encoding.c:141 tepl/tepl-encoding.c:142 tepl/tepl-encoding.c:150 msgid "Chinese Traditional" msgstr "Cinês tradizionâl" #: tepl/tepl-encoding.c:143 msgid "Cyrillic/Russian" msgstr "Cirilic/Rus" #: tepl/tepl-encoding.c:145 tepl/tepl-encoding.c:146 tepl/tepl-encoding.c:147 #: tepl/tepl-encoding.c:164 tepl/tepl-encoding.c:172 msgid "Japanese" msgstr "Gjaponês" #: tepl/tepl-encoding.c:149 tepl/tepl-encoding.c:165 tepl/tepl-encoding.c:167 #: tepl/tepl-encoding.c:175 msgid "Korean" msgstr "Corean" #: tepl/tepl-encoding.c:152 tepl/tepl-encoding.c:153 tepl/tepl-encoding.c:154 msgid "Chinese Simplified" msgstr "Cinês semplificât" #: tepl/tepl-encoding.c:155 msgid "Georgian" msgstr "Gjeorgjan" #: tepl/tepl-encoding.c:161 tepl/tepl-encoding.c:183 msgid "Hebrew" msgstr "Ebraic" #: tepl/tepl-encoding.c:170 msgid "Cyrillic/Ukrainian" msgstr "Cirilic/Ucrain" #: tepl/tepl-encoding.c:173 tepl/tepl-encoding.c:176 tepl/tepl-encoding.c:186 msgid "Vietnamese" msgstr "Vietnamît" #: tepl/tepl-encoding.c:174 msgid "Thai" msgstr "Tailandês" #: tepl/tepl-encoding.c:365 msgid "Unknown" msgstr "No cognossût" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding.c:640 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #: tepl/tepl-encoding-converter.c:302 #, c-format msgid "Conversion from character set “%s” to “%s” is not supported." msgstr "La conversion de cumbinazion di caratars “%s” a “%s” no je supuartade." #: tepl/tepl-encoding-converter.c:311 #, c-format msgid "Could not open converter from “%s” to “%s”: %s" msgstr "Impussibil convertî di “%s” a “%s”: %s" #: tepl/tepl-encoding-converter.c:368 msgid "The input data contains an invalid sequence." msgstr "I dâts in jentrade a contegnin une secuence no valide." #: tepl/tepl-encoding-converter.c:377 #, c-format msgid "Error when converting data: %s" msgstr "Erôr tal convertî i dâts: %s" #: tepl/tepl-encoding-converter.c:556 msgid "The input data ends with an incomplete multi-byte sequence." msgstr "I dâts in jentrade a finissin cuntune secuence di byte multiplis incomplete." #: tepl/tepl-encoding-converter.c:579 msgid "The input content ends with incomplete data." msgstr "Il contignût de jentrade al finìs cun dâts incomplets." #: tepl/tepl-file.c:413 #, c-format msgid "Untitled File %d" msgstr "File cence titul %d" #: tepl/tepl-file-content-loader.c:334 #, c-format msgid "The file is too big. Maximum %s can be loaded." msgstr "Il file al è masse grant. Si pues cjariâ al massim %s." #: tepl/tepl-file-loader.c:925 msgid "It is not possible to detect the character encoding automatically." msgstr "Nol è pussibil individuâ la codifiche dal caratar in automatic." #: tepl/tepl-file-saver.c:784 msgid "The file is externally modified." msgstr "Il file al è modificât di difûr di chi." #: tepl/tepl-file-saver.c:1318 msgid "The buffer contains invalid characters." msgstr "Il buffer al conten caratars no valits." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/hr.po000066400000000000000000000226631526404732400236140ustar00rootroot00000000000000# Croatian translation for tepl. # Copyright (C) 2020 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-09-11 00:26+0000\n" "PO-Revision-Date: 2020-09-19 17:23+0200\n" "Language-Team: Croatian \n" "Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "Last-Translator: gogo \n" "X-Generator: Poedit 2.3\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Novo" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Nova datoteka" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Novi _prozor" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Stvori novi prozor" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Otvori" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Otvori datoteku" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Spremi" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Spremi trenutnu datoteku" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Spremi _kao" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Spremi trenutnu datoteku u drugu lokaciju" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Poništi" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Poništi posljednju radnju" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Ponovi" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Ponovi posljednju poništenu radnju" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Iz_reži" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Izreži odabir" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopiraj" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopiraj odabir" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Zalijepi" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Zalijepi sadržaj međuspremnika" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Obriši" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Obriši odabrani tekst" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Odaberi _sve" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Odaberi sav dokument" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Uvuci" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Uvuci odabrane redke" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Raširi" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Raširi odabrane retke" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Idi na redak…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Idi na određeni redak" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Samo-za-čitanje" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Spremi promjene datoteke “%s” prije zatvaranja?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Zatvori _bez spremanja" #: tepl/tepl-close-confirm-dialog-single.c:131 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Odustani" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Spremi kao…" #: tepl/tepl-file.c:426 #, c-format msgid "Untitled File %d" msgstr "Neimenovana datoteka %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Sadržaj mora biti kôdiran u UTF-8 kôdiranju znakova." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Idi na redak:" #: tepl/tepl-goto-line-bar.c:243 msgid "Close" msgstr "Zatvori" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "_Svejedno uredi" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_Ne uređuj" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Datoteka “%s” je već otvorena u drugom prozoru." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Želite li ju ipak urediti?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "S_premi svejedno" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Ne spremaj" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "Nemoguće stvaranje sigurnosne kopije datoteke pri spremanju “%s”" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Nemoguće stvaranje sigurnosne kopije stare kopije datoteke prije spremanja " "nove. Možete zanemariti ovo upozorenje i ipak spremiti datoteku, ali ako " "greške nastanu pri spremanju, možete izgubiti staru kopiju datoteke. " "Želite li ipak spremi?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Poruka greške: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "Datoteka “%s” je promijenjena na disku." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Odbaci promjene i _učitaj ponovno" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Učitaj ponovno" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Neki neispravni znakovi su otkriveni pri spremanju “%s”." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Ako nastavite sa spremanjem ove datoteke možete oštetiti dokument. Želite " "li svejedno spremiti?" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML datoteka mora započeti s elementom, a ne “%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Očekivan je element, umjesto je dobiven “%s”." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Neuspjela obrada “atime” vrijednosti svojstva “%s”." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr " element mora sadržavati “uri” i “atime” svojstva." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Očekivan je element, umjesto je dobiven “%s”." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr " elementu nedostaje “key” ili “value” svojstvo." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Sakrij panel" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Red %d, Stupac %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Lokacija:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Zatvori datoteku" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Greška pri učitavanju datoteke." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Greška pri spremanju datoteke." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Spremi datoteku" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Otvori datoteku" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/hu.po000066400000000000000000000407321526404732400236140ustar00rootroot00000000000000# Hungarian translation for tepl. # Copyright (C) 2017, 2018, 2021, 2026 Free Software Foundation, Inc. # This file is distributed under the same license as the tepl package. # # Balázs Úr , 2017, 2018, 2021, 2026. # Balázs Meskó , 2021. msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/iss" "ues\n" "POT-Creation-Date: 2025-10-31 08:49+0000\n" "PO-Revision-Date: 2026-09-09 22:42+0200\n" "Last-Translator: Balázs Úr \n" "Language-Team: Hungarian \n" "Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Lokalize 25.12.3\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "Ú_j" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Új fájl" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Új _ablak" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Új ablak létrehozása" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Megnyitás" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Fájl megnyitása" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "M_entés" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Jelenlegi fájl mentése" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Men_tés másként" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Jelenlegi fájl mentése egy másik helyre" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "V_isszavonás" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Az utolsó művelet visszavonása" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "Új_ra" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "A visszavont művelet ismételt végrehajtása" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Kivágás" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "A kijelölés kivágása" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Másolás" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "A kijelölés másolása" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Beillesztés" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "A vágólap tartalmának beillesztése" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Törlés" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "A kijelölt szöveg törlése" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Az össz_es kijelölése" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Az összes szöveg kijelölése" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Behúzás" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "A kijelölt sorok behúzása" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "Behúzás _visszavonása" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "A kijelölt sorok behúzásának visszavonása" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Ugrás sorra…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Ugrás egy adott sorra" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Írásvédett" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Menti a változtatásokat a(z) „%s” fájlba bezárás előtt?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Bezárás mentés _nélkül" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Mégse" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "M_entés másként…" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Ugrás sorra:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Bezárás" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format #| msgid "This file “%s” is already open in another window." msgid "This file (%s) is already open in another %s window." msgstr "Ez a fájl (%s) már nyitva van egy másik %s ablakban." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s megnyitotta a fájl ezen példányát nem szerkeszthető módon. Mindenképp szerk" "eszteni szeretné?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "Sz_erkesztés mindenképp" #: tepl/tepl-io-error-info-bars.c:99 #| msgid "Read-Only" msgid "_Keep Read-Only" msgstr "_Maradjon csak olvasható" #: tepl/tepl-io-error-info-bars.c:141 #, c-format #| msgid "Could not create a backup file while saving “%s”" msgid "Could not create a backup file while saving “%s”." msgstr "Nem sikerült biztonsági mentés fájlt létrehozni a(z) „%s” mentésekor." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Nem sikerült a fájl régi másolatának biztonsági mentése az új mentése előtt. " "Figyelmen kívül hagyhatja ezt az üzenetet, és mindenképp mentheti a fájlt, " "de ha hiba történik mentéskor, akkor elvesztheti a fájl régi másolatát. " "Mindenképp menti?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Hibaüzenet: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 #| msgid "S_ave Anyway" msgid "_Save Anyway" msgstr "_Mentés mindenképp" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Ne mentse" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "A(z) „%s” fájl megváltozott a lemezen." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Ennek a dokumentumnak mentetlen módosításai vannak. El szeretné dobni a változ" "tatásait, és újratölti a fájlt?" #: tepl/tepl-io-error-info-bars.c:215 #| msgid "Do you want to edit it anyway?" msgid "Do you want to reload the file?" msgstr "Szeretné újratölteni a fájlt?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Változások elvetése és új_ratöltés" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "Új_ratöltés" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Mellőzés" #: tepl/tepl-io-error-info-bars.c:256 #, c-format #| msgid "The file “%s” changed on disk." msgid "The file “%s” has been externally modified." msgstr "A(z) „%s” fájlt egy külső program módosította." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Ha most elmenti, akkor az összes külső változtatás elveszhet. Mindenképp menti" "?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Érvénytelen karakterek észlelve a(z) „%s” mentésekor." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Ha folytatja a fájl mentését, akkor a dokumentum megsérülhet. Mindenképp " "menti?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Kiemelési mód" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Kijelölés" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Egyszerű szöveg" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Kereséskiemelési mód…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "S: %d, O: %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Az XML-fájlnak elemmel kell kezdődni, nem ezzel: „%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr " elem várt, de „%s” érkezett." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Nem sikerült az „atime” attribútum „%s” értékének feldolgozása." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "" "A elemnek tartalmaznia kell az „uri” és az „atime” attribútumokat." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr " elem várt, de „%s” érkezett." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Az elemben hiányzik a „key” vagy a „value” attribútum." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "BESZ" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ÁTÍR" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Panel elrejtése" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "A rendszer rögzített szélességű betűkészletének _használata (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "S_zerkesztő betűkészlete:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Betűkészlet" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "Sorok számának _megjelenítése" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Tabulátorok szélessége:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "_Szóközök beillesztése tabulátorok helyett" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Felejtse el, hogy nem használ tabulátorokat" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "_Aktuális sor kiemelése" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Zárójel_párok kiemelése" #: tepl/tepl-prefs.c:323 #| msgid "Highlight Mode" msgid "Highlighting" msgstr "Kiemelés" #: tepl/tepl-prefs.c:347 #| msgid "Close file" msgid "_Autosave files" msgstr "Fájlok a_utomatikus mentése" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Az automatikus mentések közötti idő _percben:" #: tepl/tepl-prefs.c:415 #| msgid "Could not create a backup file while saving “%s”" msgid "_Create a backup copy of files before saving" msgstr "Biztonsági mentés _létrehozása a fájlokról a mentés előtt" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Fájlok" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Rendszerstílus követése" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Világos stílus" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Sötét stílus" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Témaváltozat" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "_Jobb margó megjelenítése ebben az oszlopban:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Áll_apotsor megjelenítése" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Beállítások" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Valóban vissza szeretné állítani az összes beállítást?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "Összes _visszaállítása" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "Összes _visszaállítása…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Összes beállítás visszaállítása" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Tabulátorok megjelenítése" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Szóközök megjelenítése" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Új sorok megjelenítése" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Kezdő szóközök" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Szövegen belüli szóközök" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Lezáró szóközök" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tabulátor" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Szóköz" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Nem törő szóköz" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Keskeny nem törő szóköz" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Eredmény" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Információ" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Ha az üres karakterek megjelenítése engedélyezve van, akkor a nem törő " "szóközök mindig meg lesznek jelenítve az összes helyen, hogy meg legyenek " "különböztetve a normál szóközöktől." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Színséma a sötét témaváltozathoz" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Színséma a világos témaváltozathoz" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Nem támogatott a sötét témaváltozatnál" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Nem támogatott a világos témaváltozatnál" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Hely:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Fájl bezárása" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Hiba a fájl betöltésekor." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Hiba a fájl mentésekor." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Fájl mentése" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Fájl megnyitása" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/id.po000066400000000000000000000263731526404732400236010ustar00rootroot00000000000000# Indonesian translation for tepl. # Copyright (C) 2017 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Andika Triwidada , 2017. # Kukuh Syafaat , 2017, 2020. msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-11-21 14:24+0000\n" "PO-Revision-Date: 2020-12-04 15:47+0700\n" "Last-Translator: Andika Triwidada \n" "Language-Team: Indonesian \n" "Language: id\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.4.2\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Baru" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Berkas baru" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "_Jendela Baru" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Membuat jendela baru" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Buka" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Buka suatu berkas" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Simpan" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Simpan berkas saat ini" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Simp_an Sebagai" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Simpan berkas saat ini ke lokasi yang berbeda" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "Tak _Jadi" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Batalkan aksi terakhir" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Jadi Lagi" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Jadikan lagi aksi terakhir yang dibatalkan" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Po_tong" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Potong bagian yang dipilih" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "Sali_n" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Salin bagian yang dipilih" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "Tem_pel" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Tempel papan klip" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Hapus" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Hapus teks yang dipilih" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Pilih Semu_a" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Pilih semua teks" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Indentasi" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Indentasi baris yang dipilih" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "Hap_us indentasi" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Hapus indentasi baris yang dipilih" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "Ke _Baris…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Pergi ke baris tertentu" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Hanya-Baca" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Simpan perubahan ke berkas \"%s\" sebelum ditutup?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Tutup _tanpa Menyimpan" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-progress-info-bar.c:52 #: tepl/tepl-tab-saving.c:280 tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "Ba_tal" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Simpan Sebagai…" #: tepl/tepl-file.c:445 #, c-format msgid "Untitled File %d" msgstr "Berkas Tanpa Nama %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Konten harus dikodekan dengan pengkodean karakter UTF-8." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Ke baris:" #: tepl/tepl-goto-line-bar.c:243 msgid "Close" msgstr "Tutup" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "Sunt_ing Saja" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_Jangan Sunting" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Berkas \"%s\" sudah dibuka pada jendela lain." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Apakah Anda ingin tetap menyuntingnya?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "Simp_an Saja" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Jangan Simpan" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "Tidak bisa membuat berkas cadangan ketika menyimpan \"%s\"." #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Tidak dapat mencadangkan salinan berkas lama sebelum menyimpan yang baru. " "Anda bisa mengabaikan peringatan ini dan tetap menyimpan berkas, tetapi jika " "terjadi kesalahan saat menyimpan, Anda bisa kehilangan salinan berkas yang " "lama. Tetap simpan?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Pesan galat: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "Berkas \"%s\" berubah pada diska." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Buang Pe_rubahan dan Muat Ulang" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Muat Ulang" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Beberapa karakter yang tidak valid terdeteksi saat menyimpan \"%s\"." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Jika Anda terus menyimpan berkas ini, Anda dapat merusak dokumen. Tetap " "simpan?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Moda Penyorotan" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Pilih" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Teks Polos" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Mode sorot pencarian…" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Berkas XML harus dimulai dengan elemen , bukan \"%s\"." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Yang diharapkan elemen , malah mendapat \"%s\"." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Gagal menguraikan nilai atribut \"atime\" \"%s\"." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Elemen harus mengandung atribut \"uri\" dan \"atime\"." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Yang diharapkan elemen , malah mendapatkan \"%s\"." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Elemen harus mengandung atribut \"key\" dan \"value\"." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Sembunyikan panel" #: tepl/tepl-space-drawer-prefs.c:189 tepl/tepl-space-drawer-prefs.c:191 #: tepl/tepl-space-drawer-prefs.c:193 msgid "Draw tabs" msgstr "Menggambar tab" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw spaces" msgstr "Menggambar spasi" #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw new lines" msgstr "Menggambar baris baru" #: tepl/tepl-space-drawer-prefs.c:231 msgid "Leading Spaces" msgstr "Spasi Terdepan" #: tepl/tepl-space-drawer-prefs.c:235 msgid "Spaces Inside Text" msgstr "Spasi di Dalam Teks" #: tepl/tepl-space-drawer-prefs.c:239 msgid "Trailing Spaces" msgstr "Spasi di Belakang" #: tepl/tepl-space-drawer-prefs.c:259 msgid "Tab" msgstr "Tab" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Space" msgstr "Spasi" #: tepl/tepl-space-drawer-prefs.c:261 msgid "No-Break Space" msgstr "Spasi Tak Putus" #: tepl/tepl-space-drawer-prefs.c:262 msgid "Narrow No-Break Space" msgstr "Spasi Tak Putus Sempit" #: tepl/tepl-space-drawer-prefs.c:281 msgid "Result" msgstr "Hasil" #: tepl/tepl-space-drawer-prefs.c:314 msgid "Information" msgstr "Informasi" #: tepl/tepl-space-drawer-prefs.c:316 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Saat menggambar spasi putih diaktifkan, maka spasi tak putus selalu digambar " "di semua lokasi, untuk membedakannya dari ruang normal." #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Brs %d, Kol %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Lokasi:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Tutup berkas" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Galat saat memuat berkas." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Galat saat menyimpan berkas." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Simpan Berkas" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Buka Berkas" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/ja.po000066400000000000000000000307111526404732400235660ustar00rootroot00000000000000# Japanese translation for tepl. # Copyright (C) 2020-2021 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Tomo Dote , 2020. # sicklylife , 2021. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-12-04 08:48+0000\n" "PO-Revision-Date: 2021-01-01 23:50+0900\n" "Last-Translator: sicklylife \n" "Language-Team: Japanese \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "新規(_N)" #: tepl/tepl-application.c:80 msgid "New file" msgstr "新規ファイル" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "新規ウィンドウ(_W)" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "新しいウィンドウを作成します" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "開く(_O)" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "ファイルを開きます" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "保存(_S)" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "現在のファイルを保存します" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "名前を付けて保存(_A)" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "現在のファイルを別の場所に保存します" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "元に戻す(_U)" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "最後の操作に戻します" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "やり直す(_R)" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "最後の操作をやり直します" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "切り取り(_T)" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "選択範囲を切り取ります" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "コピー(_C)" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "選択範囲をコピーします" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "貼り付け(_P)" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "クリップボードから貼り付けます" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "削除(_D)" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "選択したテキストを削除します" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "すべて選択(_A)" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "すべてのテキストを選択します" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "インデント(_I)" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "選択した行をインデントします" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "インデント解除(_U)" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "選択した行のインデントを解除します" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "指定行へ移動(_G)…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "指定した行へ移動します" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "読み取り専用" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "閉じる前に“%s”への変更を保存しますか?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "保存せずに閉じる(_W)" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-progress-info-bar.c:52 #: tepl/tepl-tab-saving.c:280 tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "キャンセル(_C)" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "名前を付けて保存(_S)…" #: tepl/tepl-file.c:445 #, c-format msgid "Untitled File %d" msgstr "無題のファイル %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "" "ファイルの内容は UTF-8 文字エンコーディングである必要があります。" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "移動先の行:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "閉じる" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "とにかく編集する(_E)" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "編集しない(_D)" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "“%s”はすでに別のウィンドウで開いています。" #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "とにかく編集しますか?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "とにかく保存する(_A)" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "保存しない(_D)" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "" "“%s”を保存するときにバックアップファイルを作成できませんでした" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "新しいファイルを保存する前に古いファイルのバックアップファイルを作成するこ" "とはできません。この警告を無視してファイルを強制的に保存することは可能です" "が、保存中にエラーが発生すると古いファイルの内容を失う可能性があります。と" "にかく保存しますか?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "エラーメッセージ: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "“%s”の内容がアプリケーションの外部で書き換えられました。" #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "手元の編集内容を破棄して再読み込み(_R)" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "再読み込み(_R)" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "“%s”を保存するときに不正な文字を検出しました。" #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "このファイルの保存を続行すると、文書が壊れてしまうかもしれません。とにかく" "保存しますか?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "ハイライトモード" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "選択(_S)" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "プレーンテキスト" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "ハイライトモードを検索します…" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "" "XML ファイルは“%s”ではなく 要素で始まる必要があります。" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "" " 要素を想定していましたが“%s”を取得しました。" #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "“atime”属性値“%s”の解析に失敗しました。" #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "" " 要素は“uri”属性と“atime”属性を含む必要があります。" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "" " 要素を想定していましたが“%s”を取得しました。" #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "" " 要素に“key”属性または“value”属性がありません。" #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "パネルを隠します" #: tepl/tepl-space-drawer-prefs.c:189 tepl/tepl-space-drawer-prefs.c:191 #: tepl/tepl-space-drawer-prefs.c:193 msgid "Draw tabs" msgstr "タブを表示する" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw spaces" msgstr "スペースを表示する" #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw new lines" msgstr "改行を表示する" #: tepl/tepl-space-drawer-prefs.c:231 msgid "Leading Spaces" msgstr "行頭のスペース" #: tepl/tepl-space-drawer-prefs.c:235 msgid "Spaces Inside Text" msgstr "テキスト内のスペース" #: tepl/tepl-space-drawer-prefs.c:239 msgid "Trailing Spaces" msgstr "行末のスペース" #: tepl/tepl-space-drawer-prefs.c:259 msgid "Tab" msgstr "タブ" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Space" msgstr "スペース" #: tepl/tepl-space-drawer-prefs.c:261 msgid "No-Break Space" msgstr "ノーブレークスペース" #: tepl/tepl-space-drawer-prefs.c:262 msgid "Narrow No-Break Space" msgstr "狭いノーブレークスペース" #: tepl/tepl-space-drawer-prefs.c:281 msgid "Result" msgstr "結果" #: tepl/tepl-space-drawer-prefs.c:314 msgid "Information" msgstr "情報" #: tepl/tepl-space-drawer-prefs.c:316 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "ホワイトスペースの表示を有効にしている場合、普通のスペースと区別するために" "、ノーブレークスペースはどの位置にあっても常に表示します。" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "%d 行、%d 列" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "場所:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "ファイルを閉じます" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "ファイルを読み込むときにエラーが発生しました。" #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "ファイルを保存するときにエラーが発生しました。" #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "ファイルを保存" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "ファイルを開く" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/ka.po000066400000000000000000000626301526404732400235740ustar00rootroot00000000000000# Georgian translation for libgedit-tepl. # Copyright (C) 2024 libgedit-tepl's authors # This file is distributed under the same license as the libgedit-tepl package. # Ekaterine Papava , 2024-2025. # msgid "" msgstr "" "Project-Id-Version: libgedit-tepl main\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-21 04:46+0100\n" "Last-Translator: Ekaterine Papava \n" "Language-Team: Georgian \n" "Language: ka\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.5\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_ახალი" #: tepl/tepl-application.c:80 msgid "New file" msgstr "ახალი ფაილი" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "ახალი ფანჯარა" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "ახალი ფანჯრის შექმნა" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_გახსნა" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "ფაილის გახსნა" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_შენახვა" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "მიმდინარე ფაილის შენახვა" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "_შენახვა, როგორც" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "მიმდინარე ფაილის შენახვა სხვა მდებარეობაზე" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "გა_უქმება" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "ბოლო მოქმედების გაუქმება" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "გამეო_რება" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "ბოლოს გაუქმებული ქმედების დაბრუნება" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "ა_მოჭრა" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "მონიშნულის ამოჭრა" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_კოპირება" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "მონიშნულის კოპირება" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "ჩ_ასმა" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "გაცვლის ბუფერიდან ჩასმა" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_წაშლა" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "მონიშნული ტექსტის წაშლა" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "ყველაფრის მონიშვნა" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "ტექსტის სრულად მონიშვნა" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_შეწევა" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "მონიშნული ხაზების შეწევა" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "შეწევის გა_უქმება" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "მონიშნული ხაზების შეწევის გაუქმება" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "ხა_ზზე გადასვლა…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "მითითებულ ხაზზე გადასვლა" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "მხოლოდ-კითხვადი" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "შევინახო ცვლილებები ფაილში \"%s\" მის დახურვამდე?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "დახურვა _შენახვის გარეშე" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_შეწყვეტა" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_შენახვა, როგორც…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "უნიკოდი" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "დასავლური" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "ცენტრალურ ევროპული" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "სამხრეთ ევროპული" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "ბალტიური" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "კირილიცა" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "არაბული" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "ბერძნული" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "ივრითი ვიზუალი" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "თურქული" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "სკანდინავიელი" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "კელტური" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "რუმინული" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "სომხური" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "ჩინური ტრადიციული" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "კირილიცა რუსული" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "იაპონური" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "კორეული" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "ჩინური გამარტივებული" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "ქართული" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "ივრითი" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "კირილიცა უკრაინული" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "ვიეტნამური" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "ტაილანდური" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s (%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "შემცველობა UTF-8 კოდირებით უნდა იყოს." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "გადასვლა ხაზზე:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "დახურვა" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "ეს ფაილი (%s) უკვე ღიაა სხვა %s-ის ფანჯარაში." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s-მა ფაილის ეს გაშვებული ასლი არაჩასწორებად რეჟიმში გახსნა. გნებავთ ის " "მაინც ჩაასწოროთ?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "მაინც _ჩასწორება" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "მხოლოდ-კითხვადად _დატოვება" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "\"%s\"-ის შენახვისას მარქაფის ფაილის შექმნა შეუძლებელია." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "შეუძლებელია ძველი ასლის მარქაფი ახლის შენახვამდე. ეს გაფრთხილება შეგიძლიათ " "გამოტოვოთ და ის მაინც შეინახოთ, მაგრამ თუ შენახვისას შეცდომა მოხდება, ძველ " "ფაილსაც დაკარგავთ. მაინც გნებავთ, შევინახო?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "შეცდომის შეტყობინება: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_მაინც შენახვა" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_არ შეინახო" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "ფაილი \"%s\" დისკზე შეიცვალა." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "დოკუმენტს შეუნახავი ცვლილებები გააჩნია. გნებავთ, მოვაცილო ცვლილებები და " "ფაილი თავიდან ჩავტვირთო?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "გნებავთ, ფაილი თავიდან ჩატვირთოთ?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "ცვლილებების გაუქმება და თავიდან _ჩატვირთვა" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "თავიდან ჩატვი_რთვა" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "გამ_ოტოვება" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "ფაილი \"%s\" გარე პროგრამის მიერ შეიცვალა." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "თუ შეინახავთ, გარე ცვლილებები დაიკარგება. მაინც გნებავთ შენახვა?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "\"%s\"-ის შენახვისას აღმოჩენილია რამდენიმე არასწორი სიმბოლო." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "თუ ამ ფაილის შენახვას გააგრძელებთ, შეგიძლიათ, დოკუმენტი დააზიანოთ. მაინც " "გნებავთ შენახვა?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "გამოკვე_თის რეჟიმი" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_მონიშვნა" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "უბრალო ტექსტი" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "გამოკვე_თის რეჟიმში ძებნა…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "ხაზ %d, სვეტ %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML ფაილი ელემენტით უნდა იწყებოდეს და არა \"%s\"-ით." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "მოველოდი ელემენტს , მივიღე “%s”." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "შეცდომა \"atime\" ატრიბუტის მნიშვნელობის, \"%s\", დამუშავებისას." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "" "ელემენტი \"uri\" და \"atime\" ატრიბუტებს აუცილებლად უნდა " "შეიცავდეს." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "მოველოდი ელემენტს , მივიღე “%s”." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "ელემენტს \"key\" ან \"value\" ატრიბუტი აკლია." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "INS" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "გადაწ" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "პანელის დამალვა" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_სისტემური ფიქსირებული სიგანის მქონე ფონტის (%s) გამოყენება" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "რედაქტორის _ფონტი:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "ფონტი" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_ხაზების ნომრების ჩვენება" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_ტაბულაციის სიგანე:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "ტაბულაციის მაგიერ _გამოტოვებების ჩასმა" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_დავიწყეთ, თქვენ არ იყენებთ ტაბულაციებს" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "მიმდინარე _ხაზის გამოკვეთა" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "შესაბამისი ბრჭყალების _გამოკვეთა" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "გამოკვეთა" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "ფაილების ავტომატური _შენახვა" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "_ავტომატური შენახვის ინტერვალი (წუთები):" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "_სარეზერვო ასლის შექმნა შენახვამდე" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "ფაილი" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "სისტემის სტილის მიყოლა" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "ღია სტილი" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "მუქი სტილი" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "თემის ვარიანტი" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "_მარჯვენა საზღვრის ჩვენება სვეტთან:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "_სტატუსის ზოლის ჩვენება" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "მორგება" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "მართლა გნებავთ ყველა პარამეტრის ჩამოყრა?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "ყველას ჩამოყ_რა" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_ყველას ჩამოყრა…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "პარამეტრების ჩამოყრა" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "ტაბულაციებს დახატვა" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "გამოტოვებების დახატვა" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "ახალი ხაზების დახატვა" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "თავში მიწერილი გამოტოვებები" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "გამოტოვებები ტექსტის შიგნით" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "ბოლოში მიწერილი გამოტოვებები" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "ჩანართი" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "ჰარე" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "არაგადატანადი გამოტოვება" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "ვიწრო არაგადატანადი გამოტოვება" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "შედეგი" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "ინფორმაცია" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "როდესაც თეთრი ჰარეს დახატვა ჩართულია, მაშინ ყველა ადგილას ყოველთვის " "შედგენილია უწყვეტი ჰარეები, რათა განასხვავოს ისინი ნორმალური ჰარეებისგან." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "ფერის სქემა მუქი თემის ვარიანტისთვის" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "ფერის სქემა ღია თემის ვარიანტისთვის" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "მხარდაჭერილი არაა მუქი თემის ვარიანტისთვის" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "მხარდაჭერილი არაა ღია თემის ვარიანტისთვის" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "მდებარეობა:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "ფაილის დაკეტვა" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "შეცდომა ფაილის ჩატვირთვისას." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "შეცდომა ფაილის შენახვისას." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "ფაილის შენახვა" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "ფაილის გახსნა" #~ msgid "Display _grid pattern" #~ msgstr "ბადის _ნიმუშის ჩვენება" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/kk.po000066400000000000000000000452261526404732400236100ustar00rootroot00000000000000# Kazakh translation for libgedit-tepl. # Copyright (C) 2026 libgedit-tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the libgedit-tepl package. # Baurzhan Muftakhidinov , 2026. # msgid "" msgstr "" "Project-Id-Version: libgedit-tepl main\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-10-31 08:49+0000\n" "PO-Revision-Date: 2026-03-15 15:46+0500\n" "Last-Translator: Baurzhan Muftakhidinov \n" "Language-Team: Kazakh \n" "Language: kk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.9\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Жаңа" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Жаңа файл" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Жаңа _терезе" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Жаңа терезені жасау" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Ашу" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Файлды ашу" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Сақтау" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Ағымдағы файлды сақтау" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Қалай_ша сақтау" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Ағымдағы файлды басқа орынға сақтау" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Болдармау" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Соңғы әрекетті болдырмау" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Қайталау" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Соңғы болдырылмаған әрекетті қайталау" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Қи_ып алу" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Ерекшеленгенді қиып алу" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Көшіру" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Ерекшеленгенді көшіру" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Кірістіру" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Алмасу буферін кірістіру" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Өшіру" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Ерекшеленген мәтінді өшіру" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Барлығын _таңдау" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Барлық мәтінді таңдау" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Шегініс" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Ерекшеленген жолдар үшін шегіністі жасау" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "Шегіністі _қайтару" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Ерекшеленген жолдар үшін шегіністі қайтару" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "Жолға _өту…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Арнайы жолға өту" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Тек оқу үшін" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Жабу алдында «%s» файлындағы өзгерістерді сақтау керек пе?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Сақта_мастан жабу" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Бас тарту" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Қалай_ша сақтау…" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Жолға өту:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Жабу" #. Translators: the first %s is a filename and the second %s is an #. * application name. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Бұл файл (%s) басқа %s терезесінде ашық тұр." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s файлдың бұл данасын тек оқу үшін ашты. Сонда да оны түзетуді қалайсыз ба?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "Сонда да _түзету" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "Тек _оқу үшін қалдыру" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "«%s» сақтау кезінде сақтық көшірме файлын жасау мүмкін болмады." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Жаңасын сақтау алдында файлдың ескі көшірмесінің сақтық көшірмесін жасау " "мүмкін болмады. Сіз бұл ескертуді елемей, файлды бәрібір сақтай аласыз, " "бірақ сақтау кезінде қате орын алса, файлдың ескі көшірмесін жоғалтуыңыз " "мүмкін. Сонда да сақтау керек пе?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Қате хабарламасы: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "Сонда да _сақтау" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "Сақта_мау" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "«%s» файлы дискіде өзгертілген." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Бұл құжатта сақталмаған өзгерістер бар. Өзгерістерді тастап, файлды қайта " "жүктеуді қалайсыз ба?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Файлды қайта жүктеуді қалайсыз ба?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Өзгерістерді тастап, _қайта жүктеу" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Қайта жүктеу" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Елемеу" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "«%s» файлы сыртқы жақтан өзгертілген." #: tepl/tepl-io-error-info-bars.c:257 msgid "" "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Егер сіз оны сақтасаңыз, барлық сыртқы өзгерістер жоғалуы мүмкін. Сонда да " "сақтау керек пе?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "«%s» сақтау кезінде кейбір жарамсыз таңбалар табылды." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Егер бұл файлды сақтауды жалғастырсаңыз, құжатты зақымдауыңыз мүмкін. Сонда " "да сақтау керек пе?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Түспен ерекшелеу режимі" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Таңдау" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Қарапайым мәтін" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Түспен ерекшелеу режимін іздеу…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Жол %d, Бағ %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML файлы «%s» емес, элементінен басталуы тиіс." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr " элементі күтілді, бірақ «%s» алынды." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "«atime» атрибутының «%s» мәнін өңдеу сәтсіз аяқталды." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr " элементінде «uri» және «atime» атрибуттары болуы тиіс." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr " элементі күтілді, бірақ «%s» алынды." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr " элементінде «key» немесе «value» атрибуты жоқ." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "КІР" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "АЛМ" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Панельді жасыру" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "Жүйелік ені біркелкі қаріпті _қолдану (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "Редактор _қарібі:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Қаріп" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "Жол нөмірлерін _көрсету" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Табуляция ені:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Табуляция орнына _бос аралықтарды кірістіру" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "Табуляцияны қолданбайтыныңызды _ұмыту" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Ағымдағы жолды түспен _ерекшелеу" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Сәйкес жақшаларды түспен _ерекшелеу" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Түспен ерекшелеу" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "Файлдарды _автосақтау" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Автосақтаулар арасындағы уақыт, _минутпен:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "Сақтау алдында файлдардың сақтық _көшірмесін жасау" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Файлдар" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Жүйелік стильді қолдану" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Ашық стиль" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Күңгірт стиль" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Тема нұсқасы" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Оң жақ _шетті келесі бағанда көрсету:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Қалып-күй жолағын _көрсету" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Баптаулар" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Барлық баптауларды шынымен тастау керек пе?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "Барлығын _тастау" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "Барлығын _тастау…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Барлық баптауларды тастау" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Табуляцияларды салу" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Бос аралықтарды салу" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Жаңа жолдарды салу" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Алдындағы бос аралықтар" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Мәтін ішіндегі бос аралықтар" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Соңындағы бос аралықтар" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Табуляция" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Бос аралық" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Үзілмейтін бос аралық" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Тар үзілмейтін бос аралық" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Нәтиже" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Ақпарат" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Бос аралықтарды салу іске қосылған кезде, үзілмейтін бос аралықтарды " "қалыпты бос аралықтардан ажырату үшін олар әрқашан барлық жерде салынады." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Күңгірт тема нұсқасы үшін түстер схемасы" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Ашық тема нұсқасы үшін түстер схемасы" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Күңгірт тема нұсқасы үшін қолдау көрсетілмейді" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Ашық тема нұсқасы үшін қолдау көрсетілмейді" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Орналасуы:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Файлды жабу" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Файлды жүктеу кезіндегі қате." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Файлды сақтау кезіндегі қате." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Файлды сақтау" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Файлды ашу" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/meson.build000066400000000000000000000000711526404732400247720ustar00rootroot00000000000000I18N.gettext( GETTEXT_PACKAGE_NAME, preset: 'glib' ) libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/nl.po000066400000000000000000000300151526404732400236020ustar00rootroot00000000000000# Dutch translation for tepl. # Copyright (C) 2019 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Nathan Follens , 2019, 2021. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-09-27 11:01+0000\n" "PO-Revision-Date: 2021-04-02 13:41+0200\n" "Last-Translator: Nathan Follens \n" "Language-Team: Dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.4.2\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nieuw" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Nieuw bestand" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Nieu_w venster" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Een nieuw venster aanmaken" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Openen" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Bestand openen" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "Op_slaan" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Het huidige bestand opslaan" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Opslaan _als" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Het huidige bestand opslaan op een andere locatie" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Ongedaan maken" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Laatste actie ongedaan maken" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "Op_nieuw" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Laatste ongedaan gemaakte actie opnieuw uitvoeren" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "K_nippen" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Selectie knippen" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "K_opiëren" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Selectie kopiëren" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Plakken" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Plakken vanuit klembord" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "Verwij_deren" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Geselecteerde tekst verwijderen" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "_Alles selecteren" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Alle tekst selecteren" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Inspringen" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "De geselecteerde regels inspringen" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Niet inspringen" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "De geselecteerde regels niet inspringen" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Ga naar regel…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Naar een opgegeven regel springen" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Alleen-lezen" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Wijzigingen aan bestand ‘%s’ opslaan alvorens te sluiten?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Sluiten _zonder opslaan" #: tepl/tepl-close-confirm-dialog-single.c:131 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Annuleren" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Op_slaan als…" #: tepl/tepl-file.c:426 #, c-format msgid "Untitled File %d" msgstr "Naamloos bestand %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "De inhoud moet gecodeerd zijn met de UTF-8-tekencodering." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Ga naar regel:" #: tepl/tepl-goto-line-bar.c:243 msgid "Close" msgstr "Sluiten" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "Toch b_ewerken" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "Niet _bewerken" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Dit bestand ‘%s’ is al geopend in een ander venster." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Wilt u het bestand toch bewerken?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "Toc_h opslaan" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Niet opslaan" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "Maken van een reservekopie tijdens het opslaan van ‘%s’ is mislukt" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Kon geen reservekopie maken van het oude bestand alvorens het nieuwe bestand " "op te slaan. U kunt deze waarschuwing negeren en het nieuwe bestand toch " "opslaan, maar als er een fout optreedt tijdens het opslaan van het nieuwe " "bestand, dan kunt u mogelijk het oude bestand verliezen. Toch opslaan?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Foutbericht: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "Het bestand ‘%s’ is gewijzigd op de schijf." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Wijzigingen annuleren en he_rladen" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "He_rladen" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Er zijn enkele ongeldige tekens gedetecteerd bij het opslaan van ‘%s’." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Als u doorgaat met opslaan kan dit het document beschadigen. Toch opslaan?" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "" "Het XML-bestand moet beginnen met een -element, niet met ‘%s’." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "-element verwacht, ‘%s’ gekregen." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Ontleden van ‘atime’-attribuutwaarde ‘%s’ mislukt." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Het -element moet de attributen ‘uri’ en ‘atime’ bevatten." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "-element verwacht, ‘%s’ gekregen." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Het attribuut ‘key’ of ‘value’ ontbreekt in het -element." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Paneel verbergen" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Rg %d, kol %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Locatie:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Bestand sluiten" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Fout bij laden van bestand." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Fout bij opslaan van bestand." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Bestand opslaan" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Bestand openen" #~ msgid "Unicode" #~ msgstr "Unicode" #~ msgid "Western" #~ msgstr "Westers" #~ msgid "Central European" #~ msgstr "Centraal-Europees" #~ msgid "South European" #~ msgstr "Zuid-Europees" #~ msgid "Baltic" #~ msgstr "Baltisch" #~ msgid "Cyrillic" #~ msgstr "Cyrillisch" #~ msgid "Arabic" #~ msgstr "Arabisch" #~ msgid "Greek" #~ msgstr "Grieks" #~ msgid "Hebrew Visual" #~ msgstr "Hebreeuws visueel" #~ msgid "Turkish" #~ msgstr "Turks" #~ msgid "Nordic" #~ msgstr "Noors" #~ msgid "Celtic" #~ msgstr "Keltisch" #~ msgid "Romanian" #~ msgstr "Roemeens" #~ msgid "Armenian" #~ msgstr "Armeens" #~ msgid "Chinese Traditional" #~ msgstr "Traditioneel Chinees" #~ msgid "Cyrillic/Russian" #~ msgstr "Cyrillisch/Russisch" #~ msgid "Japanese" #~ msgstr "Japans" #~ msgid "Korean" #~ msgstr "Koreaans" #~ msgid "Chinese Simplified" #~ msgstr "Vereenvoudigd Chinees" #~ msgid "Georgian" #~ msgstr "Georgisch" #~ msgid "Hebrew" #~ msgstr "Hebreeuws" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Cyrillisch/Oekraïens" #~ msgid "Vietnamese" #~ msgstr "Vietnamees" #~ msgid "Thai" #~ msgstr "Thais" #~ msgid "Unknown" #~ msgstr "Onbekend" #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'ISO-8859-1', 'UTF-16']" #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "Conversie van tekenset ‘%s’ naar ‘%s’ wordt niet ondersteund." #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "Converteerder van ‘%s’ naar ‘%s’ kon niet geopend worden: %s" #~ msgid "The input data contains an invalid sequence." #~ msgstr "De invoergegevens bevatten een ongeldige sequentie." #~ msgid "Error when converting data: %s" #~ msgstr "Fout bij converteren van gegevens: %s" #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "De invoergegevens eindigen op een onvolledige multi-byte-sequentie." #~ msgid "The input content ends with incomplete data." #~ msgstr "De invoerinhoud eindigt op onvolledige gegevens." #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "Het bestand is te groot. Er kan maximaal %s geladen worden." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "Het is niet mogelijk de tekenset automatisch te detecteren." #~ msgid "The file is externally modified." #~ msgstr "Het bestand is extern gewijzigd." #~ msgid "The buffer contains invalid characters." #~ msgstr "De buffer bevat ongeldige tekens." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/nn.po000066400000000000000000000363451526404732400236200ustar00rootroot00000000000000# Norwegian Nynorsk translation for libgedit-tepl. # This file is distributed under the same license as the libgedit-tepl package. # Roy-Magne Mo , 2026. # msgid "" msgstr "" "Project-Id-Version: libgedit-tepl main\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2026-04-27 14:30+0000\n" "PO-Revision-Date: 2026-10-09 20:30+0200\n" "Last-Translator: Roy-Magne Mo \n" "Language-Team: Norwegian Nynorsk \n" "Language: nn\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Ny" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Ny fil" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "_Nytt vindauge" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Opprett eit nytt vindauge" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Opne" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Opne ei fil" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Lagre" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Lagre den gjeldande fila" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Lagre _som" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Lagre den gjeldande fila ein annan stad" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Angre" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Angre siste handling" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Gjer om" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Gjer om den siste handlinga du angra" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Klipp _ut" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Klipp ut det markerte" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopier" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopier det markerte" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Lim inn" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Lim inn innhaldet i utklippstavla" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Slett" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Slett den markerte teksten" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Merk _alt" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Merk all teksten" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Rykk inn" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Rykk inn dei markerte linjene" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Fjern innrykk" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Fjern innrykket på dei markerte linjene" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "Gå til _linje …" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Gå til ei bestemt linje" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Skriveverna" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Vil du lagre endringane i fila «%s» før du lukkar?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "_Lukk utan å lagre" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Avbryt" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Lagre som …" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Gå til linje:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Lukk" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Denne fila (%s) er alt open i eit anna %s-vindauge." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s opna denne instansen av fila slik at ho ikkje kan redigerast. Vil du " "redigere henne likevel?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Rediger likevel" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Behald skrivevernet" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Klarte ikkje lage tryggleikskopi under lagringa av «%s»." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Klarte ikkje ta tryggleikskopi av den gamle utgåva av fila før den nye vart " "lagra. Du kan sjå bort frå denne åtvaringa og lagre fila likevel, men " "oppstår det ein feil under lagringa, kan du miste den gamle utgåva. Vil du " "lagre likevel?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Feilmelding: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Lagre likevel" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Ikkje lagre" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Fila «%s» er endra på disken." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Dette dokumentet har endringar som ikkje er lagra. Vil du forkaste " "endringane og laste fila på nytt?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Vil du laste fila på nytt?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Forkast endringane og _last på nytt" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Last på nytt" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Ignorer" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Fila «%s» er endra av eit anna program." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Lagrar du henne, kan alle endringane frå andre program gå tapt. Vil du lagre" " likevel?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Det vart funne ugyldige teikn under lagringa av «%s»." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Held du fram med å lagre fila, kan dokumentet verte øydelagt. Vil du lagre " "likevel?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Framhevingsmodus" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Vel" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Rein tekst" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Søk etter framhevingsmodus …" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Ln %d, Kol %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML-fila må byrje med eit -element, ikkje «%s»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Venta eit -element, men fekk «%s»." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Klarte ikkje tolke verdien «%s» i attributtet «atime»." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "-elementet må innehalde «uri»- og «atime»-attributta." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Venta eit -element, men fekk «%s»." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "-elementet manglar attributtet «key» eller «value»." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "INS" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "OVR" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Gøym panel" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Bruk systemskrifta med fast breidd (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "Skrift for _redigering:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Skrift" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Vis linjenummer" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Tabulatorbreidd:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Set inn _mellomrom i staden for tabulatorar" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Gløym at du ikkje brukar tabulatorar" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Framhev gjeldande _linje" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Framhev samsvarande _parentesar" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Framheving" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Lagre filer automatisk" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "_Minutt mellom kvar automatiske lagring:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "_Lag ein tryggleikskopi av filer før lagring" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Filer" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Følg systemstil" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Lys stil" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Mørk stil" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Temavariant" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Vis høgre_marg ved kolonne:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "_Vis statuslinje" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Innstillingar" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Vil du verkeleg tilbakestille alle innstillingar?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Tilbakestill alle" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Tilbakestill alle …" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Tilbakestill alle innstillingar" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Vis tabulatorar" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Vis mellomrom" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Vis linjeskift" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Innleiande mellomrom" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Mellomrom i teksten" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Avsluttande mellomrom" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tabulator" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Mellomrom" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Hardt mellomrom" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Smalt hardt mellomrom" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Resultat" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Informasjon" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Når vising av blanke teikn er slått på, vert harde mellomrom alltid viste " "overalt, slik at dei kan skiljast frå vanlege mellomrom." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Fargeskjema for mørk temavariant" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Fargeskjema for lys temavariant" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Ikkje støtta for mørk temavariant" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Ikkje støtta for lys temavariant" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Plassering:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Lukk fil" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Feil ved lasting av fila." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Feil ved lagring av fila." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Lagre fil" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Opne fil" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/pl.po000066400000000000000000000374751526404732400236250ustar00rootroot00000000000000# Polish translation for libgedit-tepl. # Copyright © 2017-2025 the libgedit-tepl authors. # This file is distributed under the same license as the libgedit-tepl package. # Piotr Drąg , 2017-2025. # Aviary.pl , 2017-2025. # msgid "" msgstr "" "Project-Id-Version: libgedit-tepl\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-02-07 08:32+0000\n" "PO-Revision-Date: 2025-03-02 15:49+0100\n" "Last-Translator: Piotr Drąg \n" "Language-Team: Polish \n" "Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nowy" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Nowy plik" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "No_we okno" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Otwiera nowe okno" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Otwórz" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Otwiera plik" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Zapisz" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Zapisuje obecny plik" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Z_apisz jako" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Zapisuje obecny plik w innym miejscu" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Cofnij" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Cofa ostatnie działanie" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "P_onów" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Ponawia ostatnio cofnięte działanie" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Wytnij" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Wycina zaznaczenie" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "S_kopiuj" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopiuje zaznaczenie" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "Wk_lej" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Wkleja zawartość schowka" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Usuń" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Usuwa zaznaczony tekst" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Z_aznacz wszystko" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Zaznacza cały tekst" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Dodaj wcięcie" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Dodaje wcięcie do zaznaczonych wierszy" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Usuń wcięcie" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Usuwa wcięcie z zaznaczonych wierszy" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Przejdź do wiersza…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Przechodzi do podanego wiersza" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Tylko do odczytu" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Zapisać zmiany przed zamknięciem pliku „%s”?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Zamknij _bez zapisywania" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Anuluj" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Zapi_sz jako…" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Treść musi być zapisana za pomocą kodowania znaków UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Przejście do wiersza:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Zamyka" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Ten plik (%s) jest już otwarty w innym oknie %s." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "Program %s otworzył to wystąpienie pliku w sposób uniemożliwiający " "modyfikację. Zmodyfikować go mimo to?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Modyfikuj mimo to" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Zostaw w trybie tylko do odczytu" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "" "Podczas zapisywania pliku „%s” nie było możliwe utworzenie kopii zapasowej." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Nie można utworzyć kopii zapasowej pliku przed zapisaniem nowej wersji. " "Można zignorować to ostrzeżenie i kontynuować zapisywanie pliku, ale jeśli " "podczas zapisywania wystąpi błąd, możliwe jest, że poprzednia wersja pliku " "zostanie utracona. Zapisać mimo to?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Komunikat o błędzie: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Zapisz mimo to" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Nie zapisuj" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Plik „%s” został zmieniony przez inny program." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Ten dokument ma niezapisane modyfikacje. Odrzucić zmiany i ponownie wczytać " "plik?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Ponownie wczytać plik?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Odrzuć zmiany i w_czytaj ponownie" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Wczytaj ponownie" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "Zig_noruj" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Plik „%s” został zmodyfikowany poza programem." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Zapisanie spowoduje utratę wszystkich zmian wprowadzonych poza programem. " "Zapisać mimo to?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Wykryto nieprawidłowe znaki podczas zapisywania „%s”." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Kontynuacja zapisywania tego pliku może uszkodzić dokument. Zapisać mimo to?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Tryb wyróżniania elementów składni" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Wybierz" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Zwykły tekst" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Wyszukiwanie…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Wrsz %d, kol %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Plik XML musi zaczynać się od elementu , nie „%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Oczekiwano elementu , otrzymano „%s” zamiast niego." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Przetworzenie wartości „%s” atrybutu „atime” się nie powiodło." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Element musi zawierać atrybuty „uri” i „atime”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Oczekiwano elementu , otrzymano „%s” zamiast niego." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Element nie ma atrybutu „key” lub „value”." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "WST" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ZAS" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Ukrywa panel" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Systemowa o stałej szerokości (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "W edytor_ze:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Czcionka" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Numery wierszy" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Szerokość:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Spa_cje zamiast tabulatorów" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Inteligentne spacje" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Bieżący _wiersz" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "_Pasujące nawiasy" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Wyróżnianie" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Automatyczne zapisywanie" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "_Czas między zapisami w minutach:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "Tworzenie kopii _zapasowej przed zapisem" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Pliki" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Styl systemu" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Jasny styl" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Ciemny styl" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Wariant motywu" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Prawy _margines w kolumnie:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Pasek _stanu" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Preferencje" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Na pewno przywrócić wszystkie preferencje?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Przywróć wszystkie" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Przywróć wszystkie…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Przywraca wszystkie preferencje" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Wyświetlanie tabulacji" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Wyświetlanie spacji" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Wyświetlanie nowych wierszy" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Spacje na początku wierszy" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Spacje w tekście" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Spacje na końcach wierszy" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tabulacja" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Spacja" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Niełamliwa spacja" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Wąska niełamliwa spacja" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Wynik" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Informacja" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Włączenie wyświetlania białych znaków powoduje, że niełamliwe spacje są " "zawsze wyświetlane w każdym miejscu, aby rozróżnić je od zwykłych spacji." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Schemat kolorów dla ciemnego wariantu motywu" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Schemat kolorów dla jasnego wariantu motywu" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Nieobsługiwane w ciemnym wariancie motywu" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Nieobsługiwane w jasnym wariancie motywu" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Położenie:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Zamyka plik" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Błąd podczas wczytywania pliku." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Błąd podczas zapisywania pliku." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Zapis pliku" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Otwarcie pliku" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/pt.po000066400000000000000000000374301526404732400236240ustar00rootroot00000000000000# Portuguese translation for libgedit-tepl. # Copyright (C) 2026 libgedit-tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the libgedit-tepl package. # catias89 , 2026. # Hugo Carvalho , 2026. # msgid "" msgstr "" "Project-Id-Version: libgedit-tepl mainva\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2026-04-27 14:30+0000\n" "PO-Revision-Date: 2026-07-30 15:08+0100\n" "Last-Translator: Cátia Silva \n" "Language-Team: Portuguese \n" "Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.4.2\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Novo" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Novo ficheiro" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Nova _janela" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Criar nova janela" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Abrir" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Abrir ficheiro" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Guardar" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Guardar ficheiro atual" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Guardar _como" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Guardar o ficheiro atual numa localização diferente" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Desfazer" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Desfazer a última ação" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Refazer" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Refazer a última ação" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Cor_tar" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Cortar a seleção" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Copiar" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Copiar a seleção" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Colar" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Colar a partir da área de transferência" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Eliminar" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Eliminar o texto selecionado" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Selecionar _tudo" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Selecionar todo o texto" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Indentar" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Indentar linhas selecionadas" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Desfazer indentação" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Desfazer indentação das linhas selecionadas" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Ir para a linha…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Ir para uma linha específica" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Apenas-Leitura" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Guardar as alterações ao ficheiro \"%s\" antes de fechar?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Fechar _sem guardar" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Cancelar" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Guardar como…" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Ir para a linha:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Fechar" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Este ficheiro (%s) já se encontra aberto noutra %s janela." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s abriu esta instância do ficheiro em modo não editável. Deseja editar " "mesmo assim?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Editar Mesmo Assim" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Manter Apenas Leitura" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "" "Não foi possível criar um ficheiro de backup durante a gravação de \"%s\"." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Não foi possível fazer backup de uma cópia antiga do ficheiro antes de " "guardar o novo. Pode ignorar este aviso e guardar o ficheiro, mas em caso de " "ocorrência de erro durante a gravação, pode perder a cópia antiga do " "ficheiro. Guardar mesmo assim?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Mensagem de erro: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Guardar mesmo assim" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Não guardar" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "O ficheiro \"%s\" foi alterado no disco." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Este documento possui modificações não guardadas. Pretende descartar as suas " "alterações e recarregar o ficheiro?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Pretende recarregar o ficheiro?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Descartar alterações e _recarregar" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Recarregar" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "Ignorar" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "O ficheiro\"%s\" foi modificado externamente." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Se o guardar, todas as alterações externas podem ser perdidas. Guardar mesmo " "assim?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "" "Foram detetados alguns caracteres inválidos durante a gravação de \"%s\"." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Se continuar com a gravação deste ficheiro, pode corromper o documento. " "Guardar mesmo assim?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Modo de destaque" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "Selecionar" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Texto simples" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Pesquisar modo de destaque…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Ln %d, Col %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "" "O ficheiro XML deve começar com um elemento , e não com \"%s\"." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Esperava-se um elemento , mas obteve-se “%s”." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Falha na análise do valor do atributo \"atime\" \"%s\"." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "O elemento deve \"conter os atributos \"uri\" e \"atime\"." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Esperava-se um elemento , mas obteve-se “%s”." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Falta o atributo \"chave\" ou \"valor\" no elemento ." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "INS" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "OVR" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Ocultar painel" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Usar a largura fixa do tipo de letra do sistema (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "Editor de _tipos de letra:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Tipo de letra" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Mostrar numeração de linhas" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "Largura da _Tabulação:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Inserir _espaços em vez de tabulações" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Esquecer utilização de tabulações" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Destacar _linha atual" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Destacar _parênteses correspondentes" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Destaque" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Gravação automática de ficheiros" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Tempo em _minutos entre cada gravação automática:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "_Criar uma cópia de backup dos ficheiros antes de guardar" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Ficheiros" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Seguir estilo do sistema" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Estilo de luz" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Estilo escuro" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Variação do tema" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Mostrar _margem direita na coluna:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Mostrar _barra de estado" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Preferências" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Pretende restaurar todas as preferências?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Repor tudo" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Repor tudo…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Restaurar todas as preferências" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Mostrar tabulações" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Mostrar espaços" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Mostrar novas linhas" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Espaços Iniciais" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Espaços dentro do texto" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Espaços à direita" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tab" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Espaço" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Espaço sem quebra" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Espaço sem quebra estreito" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Resultado" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Informação" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Quando a opção \"Mostrar Espaços\" está ativa, os espaços sem quebra são " "sempre apresentados em todas as localizações para os distinguir dos espaços " "normais." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Esquema de cores para a variante do tema escuro" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Esquema de cores para a variante do tema claro" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Não suportado para a variante do tema escuro" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Não suportado para a variante do tema claro" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Localização:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Fechar ficheiro" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Erro ao carregar o ficheiro." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Erro ao guardar o ficheiro." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Guardar ficheiro" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Abrir ficheiro" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/pt_BR.po000066400000000000000000000503431526404732400242050ustar00rootroot00000000000000# Brazilian Portuguese translation for libgedit-tepl. # Copyright (C) 2025 libgedit-tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the libgedit-tepl package. # Henrique Machado Campos , 2020. # Enrico Nicoletto , 2020. # Juliano de Souza Camargo , 2024. # Rafael Fontenelle , 2017-2025. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-20 23:12-0300\n" "Last-Translator: Rafael Fontenelle \n" "Language-Team: Brazilian Portuguese \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" "X-Generator: Gtranslator 47.1\n" "X-Project-Style: gnome\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Novo" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Novo arquivo" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Nova _janela" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Cria uma nova janela" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Abrir" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Abre um arquivo" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Salvar" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Salva o arquivo atual" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Salvar _como" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Salva o arquivo atual em um local diferente" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Desfazer" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Desfaz a última ação" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Refazer" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Refaz a última ação desfeita" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Recor_tar" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Recorta a seleção" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Copiar" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Copia a seleção" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "C_olar" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Cola conteúdo da área de transferência" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "E_xcluir" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Exclui o texto selecionado" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Selecionar _tudo" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Seleciona todo o texto" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Recuar" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Recua as linhas selecionadas" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "Re_tirar recuo" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Retira recuo das linhas selecionadas" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Ir para linha…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Vai para a linha específica" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Apenas leitura" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Salvar alterações ao arquivo “%s” antes de fechar?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "_Fechar sem salvar" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Cancelar" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Salvar como…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "Unicode" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "Ocidental" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "Centro-europeu" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "Sul-europeu" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "Báltico" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "Cirílico" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "Árabe" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "Grego" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "Hebreu visual" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "Turco" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "Nórdico" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "Céltico" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "Romeno" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "Armênio" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "Chinês tradicional" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "Cirílico/Russo" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "Japonês" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "Coreano" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "Chinês simplificado" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "Georgiano" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "Hebreu" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "Cirílico/Ucraniano" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "Vietnamita" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "Tailandês" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s (%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "O conteúdo deve estar codificado com a codificação de caractere UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Ir para a linha:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Fechar" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Este arquivo (%s) já está aberto em outra janela do %s." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s abriu esta instância do arquivo de forma não editável. Você quer editá-lo " "mesmo assim?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Editar mesmo assim" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Manter somente leitura" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Não foi possível criar um arquivo backup ao salvar “%s”." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Não foi possível fazer backup da cópia antiga do arquivo antes de salvar o " "novo. Você pode ignorar esse aviso e salvar o arquivo de qualquer maneira, " "mas se ocorrer um erro ao salvar, poderá perder a cópia antiga do arquivo. " "Salvar mesmo assim?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Mensagem de erro: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Salvar mesmo assim" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Não salvar" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "O arquivo “%s” foi alterado no disco." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Este documento tem modificações não salvas. Você quer soltar suas alterações " "e recarregar o arquivo?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Deseja recarregar o arquivo?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Descartar alterações e _recarregar" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Recarregar" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Ignorar" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "O arquivo “%s” foi modificado externamente." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Se você salvá-lo, todas as alterações externas podem ser perdidas. Salvar " "mesmo assim?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Alguns caracteres inválidos foram detectados ao salvar “%s”." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Se você continuar salvando este arquivo, poderá corromper o documento. " "Salvar mesmo assim?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Modo de realce" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "Se_lecionar" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Texto simples" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Pesquisar modo de realce…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Lin %d, Col %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "O arquivo XML deve começar com um elemento , não “%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Esperava um elemento , obtido “%s”." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Falha ao analisar o valor do atributo “atime” “%s”." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "O elemento deve conter os atributos “uri” e “atime”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Esperava um elemento , obtido “%s”." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "O elemento deve carece dos atributos “key” e “value”." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "INS" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "SOBR" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Ocultar painel" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Usar a fonte de largura fixa do sistema (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "_Fonte do editor:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Fonte" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Exibir números de linhas" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "Largura das _tabulações:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Inserir _espaços em vez de tabulações" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Esquecer que não está usando tabulações" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Realçar a _linha atual" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Destacar parênteses _correspondentes" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Realce" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "Salvar arquivos _automaticamente" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Tempo em _minutos entre cada salvamento automático:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "_Criar uma cópia de _backup dos arquivos antes de salvar" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Arquivos" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Seguir estilo do sistema" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Estilo claro" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Estilo escuro" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Variante do tema" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Exibir _margem direita na coluna:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Exibir barra de e_stado" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Preferências" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Você realmente deseja redefinir todas as preferências?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Redefinir tudo" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Redefinir tudo…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Redefine todas as preferências" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Desenhar abas" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Desenhar espaços" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Desenhar novas linhas" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Espaços ao começo do texto" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Espaços dentro do texto" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Espaços ao final do texto" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tabulação" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Espaço" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Espaço sem quebra" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Espaço estreito sem quebra" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Resultado" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Informação" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Quando o desenho de espaços vazios está habilitado os espaços sem quebra são " "sempre desenhados, em todos os locais, para distingui-los de espaços normais." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Esquema de cores para a variante de tema escuro" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Esquema de cores para a variante de tema claro" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Sem suporte para a variante de tema escuro" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Sem suporte para a variante de tema claro" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Localização:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Fecha o arquivo" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Erro ao carregar o arquivo." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Erro ao salvar o arquivo." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Salvar arquivo" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Abrir arquivo" #~ msgid "Display _grid pattern" #~ msgstr "Exibir padrão de _grade" #, c-format #~ msgid "Untitled File %d" #~ msgstr "Arquivo sem título %d" #~ msgid "_Don’t Edit" #~ msgstr "_Não editar" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/ro.po000066400000000000000000000306261526404732400236210ustar00rootroot00000000000000# Romanian translation for tepl. # Copyright (C) 2019 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Florentina Mușat , 2019. # msgid "" msgstr "" "Project-Id-Version: tepl tepl-4-0\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/tepl/issues\n" "POT-Creation-Date: 2020-05-29 12:28+0000\n" "PO-Revision-Date: 2020-07-19 15:51+0300\n" "Last-Translator: Florentina Mușat \n" "Language-Team: Romanian \n" "Language: ro\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " "20)) ? 1 : 2);;\n" "X-Generator: Poedit 2.3.1\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nou" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Fișier nou" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "_Fereastră nouă" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Creează o fereastră nouă" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Deschide" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Deschide un fișier" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Salvează" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Salvează fișierul curent" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Salvează _ca" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Salvează fișierul curent într-o locație diferită" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Refă" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Refă ultima acțiune" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Repetă" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Repetă ultima acțiune refăcută" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Taie" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Taie selecția" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Copiază" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Copiază selecția" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "Li_pește" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Lipește clipboardul" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "Șt_erge" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Șterge textul selectat" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Selectează to_ate" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Selectează tot textul" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Indentează" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Indentează liniile selectate" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "An_ulați indentarea" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Anulați indentarea liniilor selectate" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "Mer_gi la linia…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Mergi la o linie specifică" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Doar citire" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Salvați modificările la fișierul „%s” înainte de închidere?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Închide _fără a salva" #: tepl/tepl-close-confirm-dialog-single.c:131 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Anulează" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Salvează ca…" #: tepl/tepl-file.c:426 #, c-format msgid "Untitled File %d" msgstr "Fișier fără titlu %d" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Conținutul trebuie să fie codat cu codarea de caracter UTF-8." #: tepl/tepl-goto-line-bar.c:235 msgid "Go to line:" msgstr "Mergi la linia:" #: tepl/tepl-goto-line-bar.c:243 msgid "Close" msgstr "Închide" #: tepl/tepl-io-error-info-bars.c:42 msgid "_Edit Anyway" msgstr "_Editează oricum" #: tepl/tepl-io-error-info-bars.c:46 msgid "_Don’t Edit" msgstr "_Nu edita" #: tepl/tepl-io-error-info-bars.c:52 #, c-format msgid "This file “%s” is already open in another window." msgstr "Acest fișier „%s” este deja deschis într-o altă fereastră." #: tepl/tepl-io-error-info-bars.c:57 msgid "Do you want to edit it anyway?" msgstr "Doriți să îl editați oricum?" #: tepl/tepl-io-error-info-bars.c:91 tepl/tepl-io-error-info-bars.c:193 msgid "S_ave Anyway" msgstr "S_alvează oricum" #: tepl/tepl-io-error-info-bars.c:95 tepl/tepl-io-error-info-bars.c:197 msgid "_Don’t Save" msgstr "_Nu salva" #: tepl/tepl-io-error-info-bars.c:101 #, c-format msgid "Could not create a backup file while saving “%s”" msgstr "" "Nu s-a putut crea un fișier de copie de rezervă în timpul salvării a „%s”" #: tepl/tepl-io-error-info-bars.c:106 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Nu s-a putut copia de rezervă copia veche a fișierului înaintea salvării " "celei noi. Puteți ignora acest avertisment și să salvați fișierul oricum, " "dar dacă o eroare se întâmplă în timp ce salvați, ați putea pierde copia " "veche a fișierului. Salvați oricum?" #: tepl/tepl-io-error-info-bars.c:115 #, c-format msgid "Error message: %s" msgstr "Mesaj de eroare: %s" #: tepl/tepl-io-error-info-bars.c:152 #, c-format msgid "The file “%s” changed on disk." msgstr "Fișierul „%s” s-a schimbat pe disc." #: tepl/tepl-io-error-info-bars.c:157 msgid "Drop Changes and _Reload" msgstr "Abandonează modificările și _reîncarcă" #: tepl/tepl-io-error-info-bars.c:157 msgid "_Reload" msgstr "_Reîncarcă" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Unele caractere nevalide au fost detectate în timpul salvării „%s”." #: tepl/tepl-io-error-info-bars.c:208 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Dacă continuați să salvați acest fișier puteți să corupeți documentul. " "Salvați oricum?" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Fișierul XML trebuie să înceapă cu un element , nu „%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "S-a așteptat un element , s-a obținut „%s” în loc." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Nu s-a putut parsa atributul „atime” valoarea „%s”." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Elementul trebuie să conțină atributele „uri” și „atime”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "S-a așteptat un element , s-a obținut „%s” în loc." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Elementului îi lipsește atributul „cheie” sau „valoare”." #: tepl/tepl-panel.c:92 msgid "Hide panel" msgstr "Ascunde panoul" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-statusbar.c:103 #, c-format msgid "Ln %d, Col %d" msgstr "Ln %d, Col %d" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Locație:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Închide fișierul" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Eroare la încărcarea fișierului." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Eroare la salvarea fișierului." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Salvează fișierul" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Deschide un fișier" #~ msgid "Open “%s”" #~ msgstr "Deschide „%s”" #~ msgid "Open _Recent" #~ msgstr "Deschide _recent" #~ msgid "Open a file recently used with %s" #~ msgstr "Deschide un fișier utilizat recent cu %s" #~ msgid "Unicode" #~ msgstr "Unicode" #~ msgid "Western" #~ msgstr "Vestic" #~ msgid "Central European" #~ msgstr "European central" #~ msgid "South European" #~ msgstr "European sudic" #~ msgid "Baltic" #~ msgstr "Baltic" #~ msgid "Cyrillic" #~ msgstr "Chirilică" #~ msgid "Arabic" #~ msgstr "Arabă" #~ msgid "Greek" #~ msgstr "Greacă" #~ msgid "Hebrew Visual" #~ msgstr "Ebraică vizuală" #~ msgid "Turkish" #~ msgstr "Turcă" #~ msgid "Nordic" #~ msgstr "Nordic" #~ msgid "Celtic" #~ msgstr "Celtic" #~ msgid "Romanian" #~ msgstr "Română" #~ msgid "Armenian" #~ msgstr "Armeană" #~ msgid "Chinese Traditional" #~ msgstr "Chineză tradițional" #~ msgid "Cyrillic/Russian" #~ msgstr "Chirilică/Rusă" #~ msgid "Japanese" #~ msgstr "Japoneză" #~ msgid "Korean" #~ msgstr "Coreeană" #~ msgid "Chinese Simplified" #~ msgstr "Chineză simplificată" #~ msgid "Georgian" #~ msgstr "Georgiană" #~ msgid "Hebrew" #~ msgstr "Ebraică" #~ msgid "Cyrillic/Ukrainian" #~ msgstr "Chirilică/Ucraineană" #~ msgid "Vietnamese" #~ msgstr "Vietnameză" #~ msgid "Thai" #~ msgstr "Thailandeză" #~ msgid "Unknown" #~ msgstr "Necunoscut" #~ msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #~ msgstr "[„UTF-8”, „CURENT”, „ISO-8859-15”, „UTF-16”]" #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "Conversia de la setul de caractere „%s” la „%s” nu este suportată." #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "Nu s-a putut deschide convertorul de la „%s” la „%s”: %s" #~ msgid "The input data contains an invalid sequence." #~ msgstr "Datele de intrare conțin o secvență nevalidă." #~ msgid "Error when converting data: %s" #~ msgstr "Eroare la convertirea datelor: %s" #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "Datele de intrare se termină cu o secvență multi-octeți incompletă." #~ msgid "The input content ends with incomplete data." #~ msgstr "Conținutul intrării se termină cu date incomplete." #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "Fișierul este prea mare. Poate fi încărcat maxim %s." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "Nu este posibil să se detecteze automat codarea." #~ msgid "The file is externally modified." #~ msgstr "Fișierul este modificat extern." #~ msgid "The buffer contains invalid characters." #~ msgstr "Buffer-ul conține caractere nevalide." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/ru.po000066400000000000000000000615441526404732400236320ustar00rootroot00000000000000# Russian translation for tepl. # Copyright (C) 2017 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-16 22:27+1000\n" "Last-Translator: Ser82-png \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Poedit 3.0.1\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Новый" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Создать новый файл" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Новое _окно" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Создать новое окно" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Открыть" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Открыть файл" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Сохранить" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Сохранить текущий файл" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Сохранить _как" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Сохранить текущий файл в другом месте" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Отменить" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Отменить последнее действие" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Повторить" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Повторить последнее действие" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Вы_резать" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Вырезать выделение" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Копировать" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Копировать выделение" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Вставить" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Вставить из буфера обмена" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Удалить" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Удалить выделенный текст" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Выделить _всё" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Выделить весь текст" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Отступ" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Сделать отступы от выбранных строк" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Без отступов" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Отменить отступы для выбранных строк" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Перейти к строке…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Перейти к определенной строке" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Только чтение" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Сохранить изменения в файле «%s» перед закрытием?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Закрыть _без сохранения" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Отменить" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Сохранить как…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "Юникод" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "Западная" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "Центральноевропейская" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "Южноевропейская" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "Балтийская" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "Кириллица" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "Арабская" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "Греческая" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "Еврейская отображаемая" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "Турецкая" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "Северная" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "Кельтская" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "Римская" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "Армянская" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "Китайская традиционная" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "Кириллица (российская)" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "Японская" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "Корейская" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "Китайская упрощённая" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "Грузинская" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "Еврейская" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "Кириллица (украинская)" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "Вьетнамская" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "Тайская" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s (%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'ISO-8859-5', 'UTF-16', ' KOI8-R']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Содержимое должно быть закодировано с использованием кодировки UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Перейти к строке:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Закрыть" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Этот файл (%s) уже открыт в другом окне %s." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "В %s этот экземпляр файла открыт в режиме только для чтения виде. Вы всё " "равно хотите его редактировать?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Редактировать в любом случае" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Оставить только для чтения" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Не удалось создать резервную копию файла при сохранении «%s»." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Не удалось создать резервную копию старого файла перед сохранением нового. " "Вы можете проигнорировать это предупреждение и сохранить файл в любом " "случае, но если при сохранении возникнет ошибка, то вы потеряете старую " "копию файла. Всё равно сохранить?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Сообщение об ошибке: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Сохранит в любом случае" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Не сохранять" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Файл «%s» изменился на диске." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "В этом документе есть несохранённые изменения. Вы хотите отказаться от " "изменений и перезагрузить файл?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Хотите перезагрузить файл?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Отбросить изменения и _перезагрузить" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Перезагрузить" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Игнорировать" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Файл «%s» был изменён внешней программой." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Если вы сохраните его, то внесённые извне изменения будут потеряны. " "Сохранить его в любом случае?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "При сохранении «%s» были обнаружены некоторые недопустимые символы." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Если вы продолжите сохранение этого файла, то можете повредить документ. Всё " "равно сохранить?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Режим подсвечивания" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Выбрать" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Простой текст" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Поиск режима подсвечивания…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Стр %d, Стлб %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Файл XML должен начинаться с элемента , а не с «%s»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Ожидался элемент , вместо него получен «%s»." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Не удалось обработать значение атрибута «atime» «%s»." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Элемент должен содержать атрибуты «uri» и «atime»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Ожидался элемент , вместо него получен «%s»." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Элемент не содержит атрибута «key» или «value»." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "ВСТ" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ЗАМ" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Скрыть панель" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_ Использовать системный шрифт фиксированной ширины (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "_Шрифт редактора:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Шрифт" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Показывать номера строк" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "Ширина _табуляции:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Вставлять _пробелы вместо табуляции" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Забыть о том, что вы не пользуетесь табуляциями" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Выделять текущую _строку" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Выделять соответствующие _скобки" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Подсвечивание" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Автосохранение файлов" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Время в _минутах между каждым автосохранением:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "_Создавать резервную копию файлов перед сохранением" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Файлы" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Системный стиль" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Светлый стиль" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Тёмный стиль" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Вариант темы" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Показывать правый _край в столбце:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Показывать _строку состояния" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Параметры" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Действительно сбросить все параметры?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Сбросить всё" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Сбросить всё…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Сбросить все параметры" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Визуализация табуляций" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Визуализация пробелов" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Визуализация разрывов строк" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Начальные пробелы" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Пробелы внутри текста" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Концевые пробелы" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Табуляция" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Пробел" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Неразрывный пробел" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Узкий неразрывный пробел" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Результат" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Сведения" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Если включена визуализация пробелов, то неразрывные пробелы будут " "визуализированы повсюду, чтобы можно было отличить их от обычных пробелов." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Цветовая схема для тёмного варианта темы" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Цветовая схема для светлого варианта темы" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Не поддерживается для тёмного варианта темы" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Не поддерживается для светлого варианта темы" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Расположение:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Закрыть файл" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Ошибка при загрузке файла." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Ошибка при сохранении файла." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Сохранить файл" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Открыть файл" #~ msgid "Display _grid pattern" #~ msgstr "Показывать се_тку" #, c-format #~ msgid "Open “%s”" #~ msgstr "Открыть «%s»" #~ msgid "Open _Recent" #~ msgstr "Открыть _недавние" #, c-format #~ msgid "Open a file recently used with %s" #~ msgstr "Открыть файл, который недавно использовался с «%s»" #~ msgid "Unknown" #~ msgstr "Неизвестная" #, c-format #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "Преобразование из набора символов «%s» в «%s» не поддерживается." #, c-format #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "Не удалось открыть конвертер из «%s» в «%s»: «%s»" #~ msgid "The input data contains an invalid sequence." #~ msgstr "Входные данные содержат недопустимую последовательность." #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "" #~ "Входные данные заканчиваются незавершенной многобайтовой " #~ "последовательностью." #~ msgid "The input content ends with incomplete data." #~ msgstr "Содержимое ввода заканчивается незавершенными данными." #, c-format #~ msgid "Untitled File %d" #~ msgstr "Безымянный файл %d" #, c-format #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "Файл слишком большой. Максимальный размер загрузки «%s»." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "Не удалось автоматически определить кодировку." #~ msgid "The buffer contains invalid characters." #~ msgstr "Буфер содержит недопустимые символы." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/sl.po000066400000000000000000000475431526404732400236250ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Matej Urbančič , 2020–2023. # Martin Srebotnjak , 2024,2025. # msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-17 11:20+0100\n" "Last-Translator: Martin Srebotnjak \n" "Language-Team: Slovenian GNOME Translation Team \n" "Language: sl_SI\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || " "n%100==4 ? 3 : 0);\n" "X-Poedit-SourceCharset: utf-8\n" "X-Generator: Poedit 3.4.2\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Nova" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Nova datoteka" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Novo _okno" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Ustvari novo okno" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Odpri" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Odpri datoteko" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Shrani" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Shrani trenutno datoteko" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Shrani _kot" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Shrani trenutno datoteko na drugo mesto" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Razveljavi" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Razveljavi zadnje dejanje" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Ponovno uveljavi" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Ponovno uveljavi zadnje razveljavljeno dejanje" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "I_zreži" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Izreže izbor" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopiraj" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopira izbor" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "Pr_ilepi" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Prilepi iz odložišča" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Izbriši" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Izbrišite izbrano besedilo" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Izberi _vse" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Izberite vse besedilo" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Zamakni" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Zamakni izbrane vrstice" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Razveljavi zamik" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Ne zamakni izbranih vrstic" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Pojdi v vrstico …" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Pojdite v določeno vrstico" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Le za branje" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Ali želite shraniti spremembe v datoteko »%s« pred zapiranjem?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Zapri _brez shranjevanja" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Prekliči" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Shrani kot …" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "Unicode" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "zahodnoevropsko" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "srednjeevropsko" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "južnoevropsko" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "baltsko" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "cirilica" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "arabsko" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "grško" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "hebrejsko predočeno" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "turško" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "nordijsko" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "keltsko" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "romunsko" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "armensko" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "kitajsko tradicionalno" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "cirilica/rusko" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "japonsko" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "korejsko" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "kitajsko poenostavljeno" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "gruzijsko" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "hebrejsko" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "cirilica/ukrajinsko" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "vietnamsko" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "tajsko" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s (%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', ‘CURRENT’, 'ISO-8859-15', 'UTF-16']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Vsebina mora biti kodirana s kodiranjem znakov UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Skoči na vrstico:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Zapri" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Datoteka »%s« je že odprta v drugem oknu %s." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s je odprl/a ta primerek datoteke na način, da ga ni mogoče urejati. Ali ga " "želite vseeno urediti?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Vseeno urejaj" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Ohrani le za branje" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Med shranjevanjem »%s« ni bilo mogoče ustvariti varnostne kopije." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Ni mogoče narediti varnostne kopije stare datoteke pred shranjevanjem nove. " "Opozorila ni priporočljivo prezreti, saj lahko med shranjevanjem pride do " "napake, pri kateri bo izgubljena tudi stara kopija datoteke. Ali želite " "datoteko vseeno shraniti?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Sporočilo o napaki: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Vseeno shrani" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Ne shrani" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Datoteka »%s« je bila spremenjena na disku." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Ta dokument vsebuje ne shranjene spremembe. Ali želite spustiti spremembe in " "znova naložiti datoteko?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Ali želite ponovno naložiti datoteko?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Zavrzi spremembe in _ponovno naloži" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Ponovno naloži" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Prezri" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Datoteka »%s« je bila zunaj spremenjena." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Če ga shranite, se lahko izgubijo vse zunanje spremembe. Ga želite vseeno " "shraniti?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Pri shranjevanju »%s« so bili zaznani nekateri neveljavni znaki." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Če nadaljujete s shranjevanjem te datoteke, lahko poškodujete dokument. Ali " "ga želite vseeno shraniti?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Način poudarjanja" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Izberi" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Navadno besedilo" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Način iskanja s poudarjanjem …" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr " Vr. %d, St. %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Datoteka XML se mora začeti z elementom in ne z »%s«." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Pričakovan je elemennt , namesto tega prejeto »%s«." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Ni bilo mogoče razčleniti vrednosti atributa »atime« »%s«." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Element mora vsebovati atributa »uri« in »atime«." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Pričakovan je elemennt , namesto tega prejeto »%s«." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Elementu manjka atribut »key« ali »value«." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "VST" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "PRE" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Skrij pult" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Uporabi sistemsko pisavo s stalno širino (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "Pisava _urejevalnika:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Pisava" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Pokaži številke vrstic" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "Širina _tabulatorja:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Vstavi _presledke namesto tabulatorjev" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "Poza_bi, da tabulatorji niso v rabi" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Poudari _trenutno vrstico" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Poudari ujemajoče _oklepaje" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Poudarjanje" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "S_amodejno shrani datoteke" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Čas v _minutah med posameznimi samodejnimi shranjevanji:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "Ustvari varnostne _kopije datotek pred shranjevanjem" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Datoteke" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Upoštevaj sistemski slog" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Svetla tema" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Temna tema" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Različica teme" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Prikaži desni _rob pri stolpcu:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Pokaži _vrstico stanja" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Možnosti" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Ali res želite ponastaviti vse nastavitve?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "Po_nastavi vse" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "Po_nastavi vse …" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Ponastavi vse nastavitve" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Nariši zavihke" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Izriši presledne znake" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Nariši nove vrstice" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Vodilni presledki" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Presledki v besedilu" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Presledki na koncu vrstic" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tabulator" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Presledek" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Ne-prelomni presledek" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Ozek ne-prelomni presledek" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Rezultat" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Podrobnosti" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Ko je izris presledkov omogočen, se neprelomni presledki vedno izrišejo na " "vseh mestih, da se razlikujejo od običajnih presledkov." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Barvna shema za temno temo" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Barvna shema za svetlo temo" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Ni podprto v različici temne teme" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Ni podprto v različici svetle teme" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Mesto:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Zapri datoteko" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Napaka pri nalaganju datoteke." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Napaka pri shranjevanju datoteke." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Shrani datoteko" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Odpri datoteko" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/sr.po000066400000000000000000000703211526404732400236210ustar00rootroot00000000000000# Serbian translation for tepl. # Copyright © 2017 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Мирослав Николић , 2017–2025. msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-26 08:38+0100\n" "Last-Translator: Мирослав Николић \n" "Language-Team: српски \n" "Language: sr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Project-Style: gnome\n" "X-Generator: Poedit 3.5\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Нова" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Нова датотека" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Нови _прозор" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Направите нови прозор" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Отвори" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Отворите датотеку" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Сачувај" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Сачувајте текућу датотеку" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Сачувај _као" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Сачувајте текућу датотеку на другом месту" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Опозови" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Опозовите последњу радњу" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Понови" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Поништите последњу раду опозива" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "_Исеци" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Исеците избор" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "У_множи" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Умножите избор" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "У_баци" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Убаците из оставе" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Обриши" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Обришите изабрани текст" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Изабери _све" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Изаберите сав текст" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Увуци" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Увуците изабране редове" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Поништи увлачење" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Поништите увлачење изабраних редова" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Иди на ред…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Идите на одређени ред" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Само за читање" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Да сачувам измене у датотеку „%s“ пре затварања?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Затвори _без чувања" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Откажи" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Сачувај као…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "Уникод" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "Западни" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "Централноевропски" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "Јужноевропски" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "Балтички" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "Ћирилични" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "Арапски" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "Грчки" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "Хебрејски визуелни" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "Турски" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "Нордијски" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "Келтски" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "Румунски" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "Јерменски" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "Кинески традиционални" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "Ћирилични/Руски" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "Јапански" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "Корејски" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "Кинески поједностављени" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "Грузијски" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "Хебрејски" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "Ћирилични/Украјински" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "Вијетнамски" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "Тајландски" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s (%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Садржај мора бити кодиран у УТФ-8 кодирању знакова." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Иди на ред:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Затвори" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Ова датотека (%s) је већ отворена у другом прозору „%s“." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s је отворио овај примерак датотеке у режиму у коме се не може уређивати. " "Да ли ипак желите да је уређујете?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "Уреди _ипак" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Задржи само за читање" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Не могу да направим резервну датотеку приликом чувања „%s“." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Не могу да направим резерву старог примерка датотеке пре чувања нове. Можете " "занемарити ово упозорење и сачувати датотеку и поред тога, али ако дође до " "грешке приликом чувања, можете да изгубите стари примерак датотеке. Да је " "ипак сачувам?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Порука грешке: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "Ипак _сачувај" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Не чувај" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Датотека „%s“ је измењена на диску." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Овај документ има несачуваних измена. Да ли желите да одбаците ваше измене и " "да поново учитате датотеку?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Да ли желите поново да учитате датотеку?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Одбаци измене и _освежи" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Освежи" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Занемари" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Датотека „%s“ је измењена споља." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "Ако је сачувате, све спољне измене биће изгубљене. Да је ипак сачувам?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Неки неисправни знакови су откривени приликом чувања „%s“." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Ако наставите чување ове датотеке можете да оштетите документ. Да ипак " "сачувам?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Режим истицања" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Изабери" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Обичан текст" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Режим истицања претраге…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Ред %d, колона %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML датотека мора почети елементом <метаподатака>, а не са „%s“." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Очекивах елемент <документ>, добих „%s“." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Нисам успео да обрадим „atime“ атрибут вредности „%s“." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Елемент <документ> мора да садржи атрибуте „uri“ и „atime“." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Очекивах елемент <унос>, добих „%s“." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Елементу <унос> недостаје атрибут „key“ или „value“." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "УБЦ" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ПРП" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Сакриј панел" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Користи системски фонт сталне ширине (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "_Фонт уређивача:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Фонт" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Прикажи бројеве редова" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "Ширина _табулатора" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Убаци _размаке уместо табулатора" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Заборави да не користим табулацију" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Истакни текући _ред" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Истакни упарене _заграде" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Истицање" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Сам сачувај датотеку" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Време у _минутима између самочувања:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "_Направи резервну датотеку пре чувања" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Датотеке" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Прати стил система" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Светли стил" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Тамни стил" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Варијанта теме" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Прикажи десну _ивицу на ступцу:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Прикажи траку _стања" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Поставке" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Да ли стварно желите да поништите све поставке?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "_Поништи све" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "_Поништи све…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Поништите све поставке" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Исцртај табулаторе" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Исцртај размаке" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Исцртај нове редове" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Водећи размаци" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Ратмаци унутар текста" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Пратећи размаци" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Таб" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Размак" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Непрекидни размак" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Скупи непрекидни размак" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Резултат" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Информације" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Када је исцртавање празнина укључено, тада се непрекидни размаци увек " "исцртавају на свим местима, да би се разликовали од обичних размака." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Шема боје за варијанту тамне теме" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Шема боје за варијанту светле теме" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Неподржано за варијанту тамне теме" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Неподржано за варијанту светле теме" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Место:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Затвори датотеку" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Грешка приликом учитавања датотеке." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Грешка приликом чувања датотеке." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Сачувај датотеку" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Отвори датотеку" #, c-format #~ msgid "Untitled File %d" #~ msgstr "Неименована датотека %d" #~ msgid "_Don’t Edit" #~ msgstr "Не _уређуј" #~ msgid "Open “%s”" #~ msgstr "Отварам „%s“" #~ msgid "Open _Recent" #~ msgstr "Отвори _скорашње" #~ msgid "Open a file recently used with %s" #~ msgstr "Отворите датотеку коју је недавно користио „%s“" #~ msgid "Unknown" #~ msgstr "Непознат" #~ msgid "Conversion from character set “%s” to “%s” is not supported." #~ msgstr "Претварање из скупа знакова „%s“ у „%s“ још није подржано." #~ msgid "Could not open converter from “%s” to “%s”: %s" #~ msgstr "Не могу да отворим претварач из „%s“ у „%s“: %s" #~ msgid "The input data contains an invalid sequence." #~ msgstr "Улазни подаци садрже неисправан низ." #~ msgid "Error when converting data: %s" #~ msgstr "Грешка приликом претварања података: %s" #~ msgid "The input data ends with an incomplete multi-byte sequence." #~ msgstr "Улазни подаци се завршавају непотпуним вишебајтним низом." #~ msgid "The input content ends with incomplete data." #~ msgstr "Улаз садржи крај са непотпуним подацима." #~ msgid "The file is too big. Maximum %s can be loaded." #~ msgstr "Датотека је превелика. Највише %s може бити учитано." #~ msgid "It is not possible to detect the character encoding automatically." #~ msgstr "Не могу аутоматски да одредим кодирање знакова." #~ msgid "The buffer contains invalid characters." #~ msgstr "Међумеморија садржи неисправне знаке." #~ msgid "Could not find the file “%s”." #~ msgstr "Не могу да нађем датотеку „%s“." #~ msgid "Please check that you typed the location correctly and try again." #~ msgstr "Проверите да ли сте исправно укуцали место и пробајте поново." #~ msgid "Unable to handle “%s:” locations." #~ msgstr "Не могу да радим са „%s:“ местима." #~ msgid "The location of the file cannot be accessed." #~ msgstr "Не могу да приступим месту датотеке." #~ msgid "“%s” is a directory." #~ msgstr "„%s“ је директоријум." #~ msgid "“%s” is not a valid location." #~ msgstr "„%s“ није исправно место." #~ msgid "" #~ "Host “%s” could not be found. Please check that your proxy settings are " #~ "correct and try again." #~ msgstr "" #~ "Не могу да нађем домаћина „%s“. Проверите да ли су ваша подешавања " #~ "посредника исправна и пробајте поново." #~ msgid "" #~ "Hostname was invalid. Please check that you typed the location correctly " #~ "and try again." #~ msgstr "" #~ "Назив домаћина беше неисправан. Проверите да ли сте исправно укуцали " #~ "место и пробајте поново." #~ msgid "“%s” is not a regular file." #~ msgstr "„%s“ није обична датотека." #~ msgid "Connection timed out. Please try again." #~ msgstr "Истекло је време за везу. Пробајте поново." #~ msgid "Unexpected error: %s" #~ msgstr "Неочекивана грешка: %s" #~ msgid "_Retry" #~ msgstr "_Покушај поново" #~ msgid "" #~ "The number of followed links is limited and the actual file could not be " #~ "found within this limit." #~ msgstr "" #~ "Број праћених веза је ограничен, а стварну датотеку не могу пронаћи у " #~ "овом опсегу." #~ msgid "You do not have the permissions necessary to open the file." #~ msgstr "Немате потребна овлашћења да отворите датотеку." #~ msgid "" #~ "Unable to detect the character encoding.\n" #~ "Please check that you are not trying to open a binary file.\n" #~ "Select a character encoding from the menu and try again." #~ msgstr "" #~ "Не могу да откријем кодирање знакова.\n" #~ "Проверите да не покушавате да отворите бинарну датотеку.\n" #~ "Изабери кодирање знакова из изборника и покушајте поново." #~ msgid "There was a problem opening the file “%s”." #~ msgstr "Дошло је до проблема при отварању датотеке „%s“." #~ msgid "" #~ "The file you opened has some invalid characters. If you continue editing " #~ "this file you could corrupt it.\n" #~ "You can also choose another character encoding and try again." #~ msgstr "" #~ "Датотека коју сте отворили има неке неисправне знакове. Ако наставите да " #~ "је уређујете можете да је оштетите.\n" #~ "Такође можете да изаберете други кодни распоред и да покушате поново." #~ msgid "Could not open the file “%s” using the “%s” character encoding." #~ msgstr "Не могу да отворим датотеку „%s“ користећи „%s“ кодирање знакова." #~ msgid "" #~ "Please check that you are not trying to open a binary file.\n" #~ "Select a different character encoding from the menu and try again." #~ msgstr "" #~ "Проверите да не покушавате да отворите бинарну датотеку.\n" #~ "Изабери други кодни распоред из изборника и покушајте поново." libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/sv.po000066400000000000000000000476761526404732400236460ustar00rootroot00000000000000# Swedish translation for tepl. # Copyright © 2017-2025 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Anders Jonsson , 2017, 2018, 2020, 2021, 2024, 2025. # Josef Andersson , 2017. # Luna Jernberg , 2020. # msgid "" msgstr "" "Project-Id-Version: tepl main\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-17 13:41+0100\n" "Last-Translator: Anders Jonsson \n" "Language-Team: Swedish \n" "Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.5\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Ny" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Ny fil" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Nytt _fönster" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Skapa ett nytt fönster" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "Ö_ppna" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Öppna en fil" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Spara" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Spara aktuell fil" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "S_para som" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Spara den aktuella filen till en annan plats" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "Å_ngra" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Ångra den senaste åtgärden" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Gör om" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Gör om senaste ångrade åtgärden" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Klipp _ut" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Klipp ut markering" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopiera" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Kopiera markeringen" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "K_listra in" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Klistra in urklipp" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Ta bort" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Ta bort den markerade texten" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Markera _allt" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Markera all text" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Indentera" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Indentera de markerade raderna" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Avindentera" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Avindentera de markerade raderna" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Gå till rad…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Gå till en specifik rad" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Skrivskyddad" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Spara ändringar till filen ”%s” innan du stänger?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "Stäng _utan att spara" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "A_vbryt" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Spara som…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "Unicode" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "Västerländsk" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "Centraleuropeisk" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "Sydeuropeisk" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "Baltisk" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "Kyrillisk" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "Arabisk" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "Grekisk" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "Hebreisk visuell" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "Turkisk" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "Nordisk" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "Keltisk" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "Rumänsk" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "Armenisk" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "Traditionell kinesisk" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "Kyrillisk/rysk" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "Japansk" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "Koreansk" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "Förenklad kinesisk" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "Georgisk" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "Hebreisk" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "Kyrillisk/ukrainsk" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "Vietnamesisk" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "Thailändsk" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s (%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Innehållet måste vara kodat med teckenkodningen UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Gå till rad:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Stäng" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Denna fil ”%s” är redan öppnad i ett annat %s-fönster." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s öppnade denna instans av filen på ett ej redigerbart sätt. Vill du " "redigera den i alla fall?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "R_edigera ändå" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Behåll skrivskyddad" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Kunde inte skapa en säkerhetskopia när ”%s” sparades." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Kunde inte säkerhetskopiera den gamla kopian av filen före den nya sparas. " "Du kan ignorera denna varning och spara filen ändå, men om ett fel inträffar " "när den sparas så kan du förlora den gamla kopian av filen. Spara ändå?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Felmeddelande: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "_Spara ändå" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "Spara _inte" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Filen ”%s” har ändrats på disken." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Detta dokument har osparade ändringar. Vill du förkasta dina ändringar och " "läsa in filen igen?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Vill du läsa in filen igen?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Förkasta ändringar och _läs om" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Läs om" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Ignorera" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Filen ”%s” har ändrats externt." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Om du sparar den så kan alla externa ändringar gå förlorade. Spara den ändå?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Några ogiltiga tecken har upptäckts under sparning av ”%s”." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Om du fortsätter med att spara denna fil kan du skada dokumentet. Spara ändå?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Färgmarkeringsläge" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Markera" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Vanlig text" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Sök färgmarkeringsläge…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Rad %d, Kol %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML-filen måste starta med elementet , inte ”%s”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Förväntade elementet , hittade ”%s” istället." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Misslyckades med att tolka attributvärdet ”%s” för ”atime”." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Elementet måste innehålla attributen ”uri” och ”atime”." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Förväntade elementet , hittade ”%s” istället." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Elementet saknar attributet ”key” eller ”value”." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "INF" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ÖVR" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Dölj panel" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Använd systemets typsnitt med fast breddsteg (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "_Typsnitt för redigerare:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Typsnitt" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "_Visa radnummer" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Tabulatorbredd:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Infoga _blanksteg i stället för tabulatortecken" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Glöm att du inte använder tabulatorer" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Färgmarkera _aktuell rad" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Färgmarkera matchande _parenteser" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Färgmarkering" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "Spara filer _automatiskt" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Tid i _minuter mellan varje automatisk sparning:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "S_kapa en säkerhetskopia av filer innan de sparas" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Filer" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Följ systemets stil" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Ljus stil" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Mörk stil" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Temavariant" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Visa höger_marginal på kolumn:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Visa _statusrad" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Inställningar" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Är du säker på att du vill återställa alla inställningar?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "Åte_rställ alla" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "Åte_rställ alla…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Återställ alla inställningar" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Rita ut tabulatorer" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Rita ut blanksteg" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Rita ut nya rader" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Inledande blanksteg" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Blanksteg inuti text" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Eftersläpande blanksteg" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Tabulator" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Blanksteg" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Icke-brytande blanksteg" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Smalt icke-brytande blanksteg" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Resultat" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Information" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "När utritning av blanksteg är aktiverad ritas icke-brytande blanksteg alltid " "ut på alla platser, för att skilja dem från vanliga blanksteg." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Färgschema för den mörka temavarianten" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Färgschema för den ljusa temavarianten" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Stöds ej för den mörka temavarianten" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Stöds ej för den ljusa temavarianten" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Plats:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Stäng fil" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Fel vid inläsning av filen." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Fel vid sparande av filen." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Spara fil" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Öppna fil" #~ msgid "Display _grid pattern" #~ msgstr "Visa r_utnätsmönster" #, c-format #~ msgid "Untitled File %d" #~ msgstr "Namnlös fil %d" #~ msgid "_Don’t Edit" #~ msgstr "Redigera _inte" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/tr.po000066400000000000000000000372301526404732400236240ustar00rootroot00000000000000# Turkish translation for libgedit-tepl. # Copyright (C) 2019 tepl's COPYRIGHT HOLDER # Copyright (C) 2024 libgedit-tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the libgedit-tepl package. # # Serdar Sağlam , 2019. # Muhammet Kara , 2021. # Sabri Ünal , 2019, 2024. # Emin Tufan Çetin , 2019-2025. # msgid "" msgstr "" "Project-Id-Version: libgedit-tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-08-10 22:32+0000\n" "PO-Revision-Date: 2025-01-17 08:00+0300\n" "Last-Translator: Emin Tufan Çetin \n" "Language-Team: Turkish \n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.5\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "_Yeni" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Yeni dosya" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Yeni _Pencere" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Yeni pencere oluştur" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Aç" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Dosya aç" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "_Kaydet" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Geçerli dosyayı kaydet" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "_Farklı Kaydet" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Geçerli dosyayı farklı konuma kaydet" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "Geri _Al" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Son işlemi geri al" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Yeniden Yap" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Geri alınmış işlemi yeniden yap" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Ke_s" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Seçimi kes" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Kopyala" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Seçimi kopyala" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "_Yapıştır" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Panodan yapıştır" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "_Sil" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Seçili metni sil" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "_Tümünü seç" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Tüm metni seç" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "_Girinti" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Seçili çizgileri girintile" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "_Çıkıntı" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Seçili çizgileri geri al" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "Satıra _Git…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Belirli bir satıra git" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Salt Okunur" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "“%s” dosyasını kapatmadan önce değişiklikler kaydedilsin mi?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "_Kaydetmeden Kapat" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_İptal" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "_Farklı Kaydet…" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Satıra git:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Kapat" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Bu dosya (%s) başka %s penceresinde zaten açık." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "%s, dosyanın bu örneğini düzenlenemez biçimde açtı. Yine de düzenlemek " "istiyor musunuz?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "Yine De Düz_enle" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "Salt Okunur _Tut" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "“%s” kaydedilirken yedek dosya oluşturulamadı." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Dosyanın eski kopyası, yenisini kaydetmeden önce yedeklenemedi. Bu uyarıyı " "görmezden gelip yine de dosyayı kaydedebilirsiniz, ama eğer kaydederken hata " "oluşursa dosyanın eski kopyasını yitirebilirsiniz. Yine de kaydedilsin mi?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Hata iletisi: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "Yine De K_aydet" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "Kay_detme" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "“%s” dosyası diskte değiştirildi." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "Belgede kaydedilmemiş değişiklikler var. Değişiklikleri atmak ve dosyayı " "yeniden yüklemek istiyor musunuz?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Dosyayı yeniden yüklemek istiyor musunuz?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Değişiklikleri At ve _Yeniden Yükle" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "_Yeniden Yükle" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Yok Say" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "“%s” dosyası dışarıdan değiştirildi." #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Kaydederseniz, dışarıda yapılmış tüm değişiklikler yitecek. Yine de " "kaydedilsin mi?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "“%s” kaydedilirken bazı geçersiz karakterler saptandı." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Bu dosyayı kaydetmeyi sürdürürseniz belgeyi bozabilirsiniz. Yine de " "kaydedilsin mi?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Vurgu Kipi" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Seç" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Düz Metin" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Arama vurgulama kipi…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "Sat %d, Süt %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML dosyası ögesiyle başlamalıdır, “%s” ile değil." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr " ögesi beklendi ama “%s” alındı." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "“atime” öznitelik değeri “%s” ayrıştırması başarısız." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr " ögesi “uri” ve “atime” özniteliklerini içermelidir." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr " ögesi beklendi ama “%s” alındı." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr " ögesinin “key” veya “value” özniteliği eksik." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "EKL" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ÜZY" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Paneli gizle" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "Sistem eş aralıklı yazı tipini (%s) _kullan" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "Düzenleyici _yazı tipi:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Yazı Tipi" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "Satır numaralarını _göster" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Sekme genişliği:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Sekme yerine _boşluk ekle" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "_Tabloları kullanmadığını unut" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Geçerli _satırı vurgula" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Eşleşen _parantezleri vurgula" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Vurgulama" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "Dosyaları _kendiliğinden kaydet" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Her kendiliğinden kaydetme arasındaki _dakika cinsinden süre:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "Kaydetmeden önce dosyanın yedek kopyasını _oluştur" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Dosyalar" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Sistem Biçemini İzle" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Açık Biçem" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Koyu Biçem" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Tema Türevi" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Sağ kenar boşluğunu sütunda _göster:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "_Durum çubuğunu göster" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Tercihler" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "Tüm tercihleri sıfırlamak istediğinize emin misiniz?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "Tümünü _Sıfırla" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "Tümünü _Sıfırla…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "Tüm tercihleri sıfırla" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Sekmeleri çiz" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Boşlukları çiz" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Yeni satırları çiz" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Öncü Boşluklar" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Metin İçindeki Boşluklar" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Sondaki Boşluklar" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Sekme" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Boşluk" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Kesintisiz Boşluk" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Kesintisiz Boşlukları Daralt" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Sonuç" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Bilgi" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Beyaz boşluk çizimi etkinleştirildiğinde, sıradan boşluklardan ayırt etmek " "için her zaman tüm konumlarda kesilmeyen boşluklar çizilir." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Koyu Tema Türevi İçin Renk Şeması" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Açık Tema Türevi İçin Renk Şeması" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Koyu tema türevinde desteklenmiyor" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Açık tema türevinde desteklenmiyor" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Konum:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Dosyayı kapat" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Dosya yüklenirken hata oldu." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Dosya kaydedilirken hata oldu." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Dosyayı Kaydet" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Dosyayı Aç" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/uk.po000066400000000000000000000561051526404732400236200ustar00rootroot00000000000000# Ukrainian translation for tepl. # Copyright (C) 2017 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # # yurchor , 2017, 2020, 2024, 2025. msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/is" "sues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-13 10:16+0200\n" "Last-Translator: Yuri Chornoivan \n" "Language-Team: Ukrainian \n" "Language: uk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=n==1 ? 3 : n%10==1 && n%100!=11 ? 0 : n" "%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Lokalize 23.04.3\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "С_творити" #: tepl/tepl-application.c:80 msgid "New file" msgstr "Новий файл" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "Створити _вікно" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "Створити нове вікно" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "_Відкрити" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "Відкрити файл" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "З_берегти" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "Зберегти поточний файл" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "Зберегти _як" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "Зберегти поточний файл до іншого місця" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "_Скасувати" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "Скасувати останню дію" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "_Повторити" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "Повторити останню скасовану дію" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "Ви_різати" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "Вирізати вибране" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "_Копіювати" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "Копіювати вибране" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "Вст_авити" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "Вставити з буфера обміну" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "Ви_лучити" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "Вилучити вибраний текст" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "Вибрати _все" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "Позначити увесь текст" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "В_ідступ" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "Додати відступ у вибраних рядках" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "С_касувати відступ" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "Скасувати додавання відступу у вибраних рядках" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "_Перейти до рядка…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "Перейти до вказаного рядка" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "Лише читання" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "Зберегти зміни до файла «%s» до закриття?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "_Не зберігати" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "_Скасувати" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "Зберегти _як…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "Юнікод" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "Західне" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "Центральноєвропейське" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "Південноєвропейське" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "Балтійське" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "Кирилиця" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "Арабська" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "Грецька" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "Єврейське візуальне" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "Турецьке" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "Північне" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "Кельтське" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "Румунське" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "Вірменське" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "Традиційне китайське" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "Кирилиця/Росія" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "Японськt" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "Корейське" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "Спрощене китайське" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "Грузинське" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "Іврит" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "Кирилиця/Україна" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "В'єтнамське" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "Тайське" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s (%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'CP1251', 'KOI8U', 'UTF-16']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "Дані має бути закодовано із використанням кодування UTF-8." #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "Перейти до рядка:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "Закрити" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "Цей файл («%s») вже відкрито в іншому вікні %s." #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "" "У %s цей екземпляр файла відкрито у режимі лише читання. Хочете редагувати " "його попри це?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "_Редагувати попри це" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "_Лишити лише для читання" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "Неможливо створити копію файла під час зберігання «%s»." #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "Неможливо створити резервну копію старого файла до збереження нового. Ви " "можете проігнорувати це попередження та зберегти попри все, але якщо під час " "збереження виникне помилка, ви втратите стару копію файла. Однаково зберегти?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "Повідомлення про помилку: %s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "З_берегти" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "_Не зберігати" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "Файл %s змінено на диску." #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "" "До цього документа внесено зміни, які не збережено. Хочете відкинути внесені " "вами зміни і перезавантажити цей файл?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "Хочете перезавантажити файл?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "Відкинути зміни і _оновити" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "Перезаванта_жити" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "_Ігнорувати" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "Файл «%s» змінено за допомогою сторонньої програми." #: tepl/tepl-io-error-info-bars.c:257 msgid "" "If you save it, all the external changes could be lost. Save it anyway?" msgstr "" "Якщо ви збережете його, усі зовнішні зміни будуть втрачені. Зберегти все " "одно?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "Деякі неприпустимі символи виявлено під час збереження «%s»." #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "" "Ви зіпсуєте цей документ, якщо продовжите зберігання. Зберегти попри це?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "Підкреслення синтаксису" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "_Вибрати" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "Звичайний текст" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "Пошук підкреслення синтаксису…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr " Ряд. %d, Ст. %d" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "Файл XML має починатися із елемента , а не з «%s»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "Мало бути використано елемент , маємо ж «%s»." #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "Не вдалося обробити значення атрибута «atime» «%s»." #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr "Елемент має містити атрибути «uri» і «atime»." #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "Мало бути використано елемент , маємо ж «%s»." #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr "Елемент не містити атрибута «key» або «value»." #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "ВСТ" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "ЗАМ" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "Сховати панель" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "_Використовувати системний моноширинний шрифт (%s)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "_Шрифт редактора:" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "Шрифт" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "Показувати _номери рядків" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "_Ширина табуляції:" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "Вставляти _пробіли замість табуляції" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "З_абути про те, що ви не користуєтеся табуляціями" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "Під_свічувати поточний рядок" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "Виділяти відповідну д_ужку" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "Підсвічування" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "_Автоматично зберігати файли" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "Інтервал у _хвилинах між автозбереженнями:" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "С_творювати резервну копію перед збереженням" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "Файли" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "Використовувати стиль системи" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "Світлий стиль" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "Темний стиль" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "Варіант теми" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "Показувати _праве поле у стовпчику:" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "Показати _смужку стану" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "Параметри" #: tepl/tepl-prefs-dialog.c:214 #| msgid "Do you want to reload the file?" msgid "Do you really want to reset all preferences?" msgstr "Ви справді хочете відновити початкові значення усіх параметрів?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "С_касувати всі зміни" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "С_касувати всі зміни…" #: tepl/tepl-prefs-dialog.c:254 #| msgid "Preferences" msgid "Reset all preferences" msgstr "Відновити початкові значення усіх параметрів" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "Візуалізація табуляцій" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "Візуалізація пробілів" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "Візуалізація розривів рядків" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "Початкові пробіли" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "Пропуск всередині тексту" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "Кінцеві пробіли" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "Табуляція" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "Пробіл" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "Нерозривний пробіл" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "Вузький нерозривний пробіл" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "Результат" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "Відомості" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "" "Якщо увімкнено візуалізацію пробілів, нерозривні пробіли буде візуалізовано " "всюди, щоб ви могли відрізнити їх від звичайних пробілів." #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "Схема кольорів для варіанта темної теми" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "Схема кольорів для варіанта світлої теми" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "Непідтримуване для варіанта темної теми" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "Непідтримуване для варіанта світлої теми" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "Розташування:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "Закрити файл" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "Помилка під час завантаження файла." #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "Помилка під час збереження файла." #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "Збереження файла" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "Відкрити файл" #~ msgid "Display _grid pattern" #~ msgstr "Показати шаблон _ґратки" #, c-format #~ msgid "Untitled File %d" #~ msgstr "Файл без назви %d" #~ msgid "_Don’t Edit" #~ msgstr "_Не редагувати" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/po/zh_CN.po000066400000000000000000000466401526404732400242050ustar00rootroot00000000000000# Chinese (China) translation for tepl. # Copyright (C) 2020 tepl's COPYRIGHT HOLDER # This file is distributed under the same license as the tepl package. # Damned , 2020. # lumingzh , 2024-2025. # msgid "" msgstr "" "Project-Id-Version: tepl master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/World/gedit/libgedit-tepl/-/" "issues\n" "POT-Creation-Date: 2025-01-13 02:10+0000\n" "PO-Revision-Date: 2025-01-14 13:53+0800\n" "Last-Translator: lumingzh \n" "Language-Team: Chinese (China) \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Gtranslator 47.1\n" "Plural-Forms: nplurals=1; plural=0;\n" #. action, icon, label, accel, tooltip #. File menu #. Why "file" and not "document"? "Document" is not the best #. word because the action is not always to create a new #. document. For example a LaTeX document can be composed of #. several _files_. Or for source code we do not really create a #. new "document". #: tepl/tepl-application.c:79 msgid "_New" msgstr "新建(_N)" #: tepl/tepl-application.c:80 msgid "New file" msgstr "新建文件" #: tepl/tepl-application.c:82 msgid "New _Window" msgstr "新建窗口(_W)" #: tepl/tepl-application.c:83 msgid "Create a new window" msgstr "创建新窗口" #: tepl/tepl-application.c:85 tepl/tepl-window-actions-file.c:83 msgid "_Open" msgstr "打开(_O)" #: tepl/tepl-application.c:86 msgid "Open a file" msgstr "打开文件" #: tepl/tepl-application.c:88 tepl/tepl-close-confirm-dialog-single.c:137 #: tepl/tepl-tab-saving.c:281 msgid "_Save" msgstr "保存(_S)" #: tepl/tepl-application.c:89 msgid "Save the current file" msgstr "保存当前文件" #: tepl/tepl-application.c:91 msgid "Save _As" msgstr "另存为(_A)" #: tepl/tepl-application.c:92 msgid "Save the current file to a different location" msgstr "将当前文件保存到不同的位置" #. Edit menu #: tepl/tepl-application.c:96 msgid "_Undo" msgstr "撤销(_U)" #: tepl/tepl-application.c:97 msgid "Undo the last action" msgstr "撤销上一个动作" #: tepl/tepl-application.c:99 msgid "_Redo" msgstr "重做(_R)" #: tepl/tepl-application.c:100 msgid "Redo the last undone action" msgstr "重做上一次撤销的动作" #: tepl/tepl-application.c:102 msgid "Cu_t" msgstr "剪切(_T)" #: tepl/tepl-application.c:103 msgid "Cut the selection" msgstr "剪切选中的内容" #: tepl/tepl-application.c:105 msgid "_Copy" msgstr "复制(_C)" #: tepl/tepl-application.c:106 msgid "Copy the selection" msgstr "复制选中的内容" #: tepl/tepl-application.c:108 msgid "_Paste" msgstr "粘贴(_P)" #: tepl/tepl-application.c:109 msgid "Paste the clipboard" msgstr "粘贴剪贴板" #: tepl/tepl-application.c:111 msgid "_Delete" msgstr "删除(_D)" #: tepl/tepl-application.c:112 msgid "Delete the selected text" msgstr "删除选中的文本" #: tepl/tepl-application.c:114 msgid "Select _All" msgstr "全选(_A)" #: tepl/tepl-application.c:115 msgid "Select all the text" msgstr "选择全部文本" #: tepl/tepl-application.c:117 msgid "_Indent" msgstr "缩进(_I)" #: tepl/tepl-application.c:118 msgid "Indent the selected lines" msgstr "缩进选中的行" #: tepl/tepl-application.c:120 msgid "_Unindent" msgstr "取消缩进(_U)" #: tepl/tepl-application.c:121 msgid "Unindent the selected lines" msgstr "取消缩进选中的行" #. Search menu #: tepl/tepl-application.c:125 msgid "_Go to Line…" msgstr "转到行(_G)…" #: tepl/tepl-application.c:126 msgid "Go to a specific line" msgstr "转到指定的行" #: tepl/tepl-application-window.c:156 msgid "Read-Only" msgstr "只读" #: tepl/tepl-close-confirm-dialog-single.c:119 #, c-format msgid "Save changes to file “%s” before closing?" msgstr "在关闭文件“%s”之前保存更改?" #: tepl/tepl-close-confirm-dialog-single.c:125 msgid "Close _without Saving" msgstr "不保存而关闭(_W)" #: tepl/tepl-close-confirm-dialog-single.c:131 #: tepl/tepl-language-chooser-dialog.c:130 tepl/tepl-prefs-dialog.c:217 #: tepl/tepl-progress-info-bar.c:52 tepl/tepl-tab-saving.c:280 #: tepl/tepl-window-actions-file.c:82 msgid "_Cancel" msgstr "取消(_C)" #: tepl/tepl-close-confirm-dialog-single.c:143 msgid "_Save As…" msgstr "另存为(_S)…" #. UTF-8 first, so that it's the first encoding returned by #. * tepl_encoding_iconv_get_all(). #. #: tepl/tepl-encoding-iconv.c:97 tepl/tepl-encoding-iconv.c:114 #: tepl/tepl-encoding-iconv.c:115 tepl/tepl-encoding-iconv.c:116 #: tepl/tepl-encoding-iconv.c:117 tepl/tepl-encoding-iconv.c:118 #: tepl/tepl-encoding-iconv.c:119 tepl/tepl-encoding-iconv.c:120 msgid "Unicode" msgstr "万国码" #. FIXME GEOSTD8 ? #: tepl/tepl-encoding-iconv.c:99 tepl/tepl-encoding-iconv.c:111 #: tepl/tepl-encoding-iconv.c:139 tepl/tepl-encoding-iconv.c:162 msgid "Western" msgstr "西欧" #: tepl/tepl-encoding-iconv.c:100 tepl/tepl-encoding-iconv.c:140 #: tepl/tepl-encoding-iconv.c:160 msgid "Central European" msgstr "中欧" #: tepl/tepl-encoding-iconv.c:101 msgid "South European" msgstr "南欧" #: tepl/tepl-encoding-iconv.c:102 tepl/tepl-encoding-iconv.c:109 #: tepl/tepl-encoding-iconv.c:167 msgid "Baltic" msgstr "波罗的语" #: tepl/tepl-encoding-iconv.c:103 tepl/tepl-encoding-iconv.c:141 #: tepl/tepl-encoding-iconv.c:148 tepl/tepl-encoding-iconv.c:150 #: tepl/tepl-encoding-iconv.c:151 tepl/tepl-encoding-iconv.c:161 msgid "Cyrillic" msgstr "西里尔语" #: tepl/tepl-encoding-iconv.c:104 tepl/tepl-encoding-iconv.c:144 #: tepl/tepl-encoding-iconv.c:166 msgid "Arabic" msgstr "阿拉伯语" #: tepl/tepl-encoding-iconv.c:105 tepl/tepl-encoding-iconv.c:163 msgid "Greek" msgstr "希腊语" #: tepl/tepl-encoding-iconv.c:106 msgid "Hebrew Visual" msgstr "希伯来语视觉" #: tepl/tepl-encoding-iconv.c:107 tepl/tepl-encoding-iconv.c:142 #: tepl/tepl-encoding-iconv.c:164 msgid "Turkish" msgstr "土耳其语" #: tepl/tepl-encoding-iconv.c:108 msgid "Nordic" msgstr "北欧" #: tepl/tepl-encoding-iconv.c:110 msgid "Celtic" msgstr "凯尔特语" #: tepl/tepl-encoding-iconv.c:112 msgid "Romanian" msgstr "罗马尼亚语" #: tepl/tepl-encoding-iconv.c:122 msgid "Armenian" msgstr "亚美尼亚语" #: tepl/tepl-encoding-iconv.c:123 tepl/tepl-encoding-iconv.c:124 #: tepl/tepl-encoding-iconv.c:132 msgid "Chinese Traditional" msgstr "繁体中文" #: tepl/tepl-encoding-iconv.c:125 msgid "Cyrillic/Russian" msgstr "西里尔字母/俄语" #: tepl/tepl-encoding-iconv.c:127 tepl/tepl-encoding-iconv.c:128 #: tepl/tepl-encoding-iconv.c:129 tepl/tepl-encoding-iconv.c:146 #: tepl/tepl-encoding-iconv.c:154 msgid "Japanese" msgstr "日语" #: tepl/tepl-encoding-iconv.c:131 tepl/tepl-encoding-iconv.c:147 #: tepl/tepl-encoding-iconv.c:149 tepl/tepl-encoding-iconv.c:157 msgid "Korean" msgstr "朝鲜语" #: tepl/tepl-encoding-iconv.c:134 tepl/tepl-encoding-iconv.c:135 #: tepl/tepl-encoding-iconv.c:136 msgid "Chinese Simplified" msgstr "简体中文" #: tepl/tepl-encoding-iconv.c:137 msgid "Georgian" msgstr "格鲁吉亚语" #: tepl/tepl-encoding-iconv.c:143 tepl/tepl-encoding-iconv.c:165 msgid "Hebrew" msgstr "希伯来语" #: tepl/tepl-encoding-iconv.c:152 msgid "Cyrillic/Ukrainian" msgstr "西里尔字母/乌克兰语" #: tepl/tepl-encoding-iconv.c:155 tepl/tepl-encoding-iconv.c:158 #: tepl/tepl-encoding-iconv.c:168 msgid "Vietnamese" msgstr "越南语" #: tepl/tepl-encoding-iconv.c:156 msgid "Thai" msgstr "泰语" #. Translators: the first %s is a category, the second %s is the #. * name. #. #: tepl/tepl-encoding-iconv.c:390 #, c-format msgid "%s (%s)" msgstr "%s(%s)" #. Translators: This is the sorted list of encodings used by Tepl for #. * automatic detection of the file encoding. You may want to customize #. * it adding encodings that are common in your country, for instance the #. * GB18030 encoding for the Chinese translation. You may also want to #. * remove the ISO-8859-15 encoding (covering English and most Western #. * European languages) if you think people in your country will rarely #. * use it. 'CURRENT' is a magic value used by Tepl and it represents #. * the encoding for the current locale, so please don't translate the #. * 'CURRENT' term. Keep the same format: square brackets, single quotes, #. * commas. #. #: tepl/tepl-encoding-iconv.c:693 msgid "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']" msgstr "['UTF-8', 'CURRENT', 'GB18030', 'GBK', 'ISO-8859-15', 'UTF-16']" #: tepl/tepl-file-loader.c:341 msgid "The content must be encoded with the UTF-8 character encoding." msgstr "内容必须使用 UTF-8 字符编码进行编码。" #: tepl/tepl-goto-line-bar.c:234 msgid "Go to line:" msgstr "转到行:" #: tepl/tepl-goto-line-bar.c:242 msgid "Close" msgstr "关闭" #. Translators: the first %s is a filename and the second %s is an #. * application name. #. #: tepl/tepl-io-error-info-bars.c:76 #, c-format msgid "This file (%s) is already open in another %s window." msgstr "该文件(%s)已在另一个 %s 窗口中打开。" #: tepl/tepl-io-error-info-bars.c:89 #, c-format msgid "" "%s opened this instance of the file in a non-editable way. Do you want to " "edit it anyway?" msgstr "%s 以只读方式打开了该文件实例。您想要编辑它吗?" #: tepl/tepl-io-error-info-bars.c:95 msgid "_Edit Anyway" msgstr "仍然编辑(_E)" #: tepl/tepl-io-error-info-bars.c:99 msgid "_Keep Read-Only" msgstr "保持只读(_K)" #: tepl/tepl-io-error-info-bars.c:141 #, c-format msgid "Could not create a backup file while saving “%s”." msgstr "在保存“%s”时无法创建备份文件。" #: tepl/tepl-io-error-info-bars.c:146 msgid "" "Could not back up the old copy of the file before saving the new one. You " "can ignore this warning and save the file anyway, but if an error occurs " "while saving, you could lose the old copy of the file. Save anyway?" msgstr "" "在保存新文件之前无法备份该文件的旧副本。您可以忽略此警告并仍然保存该文件,但" "如果在保存时发生错误,您可能会丢失该文件的旧副本。仍要保存吗?" #: tepl/tepl-io-error-info-bars.c:155 #, c-format msgid "Error message: %s" msgstr "错误消息:%s" #: tepl/tepl-io-error-info-bars.c:161 tepl/tepl-io-error-info-bars.c:264 #: tepl/tepl-io-error-info-bars.c:314 msgid "_Save Anyway" msgstr "仍然保存(_S)" #: tepl/tepl-io-error-info-bars.c:165 tepl/tepl-io-error-info-bars.c:268 #: tepl/tepl-io-error-info-bars.c:318 msgid "_Don’t Save" msgstr "不保存(_D)" #: tepl/tepl-io-error-info-bars.c:203 #, c-format msgid "The file “%s” changed on disk." msgstr "文件“%s”已在磁盘上更改。" #: tepl/tepl-io-error-info-bars.c:210 msgid "" "This document has unsaved modifications. Do you want to drop your changes " "and reload the file?" msgstr "此文档有未保存修改。您想要丢弃修改并重新加载该文件吗?" #: tepl/tepl-io-error-info-bars.c:215 msgid "Do you want to reload the file?" msgstr "您想要重新加载该文件吗?" #: tepl/tepl-io-error-info-bars.c:220 msgid "Drop Changes and _Reload" msgstr "丢弃更改并重新载入(_R)" #: tepl/tepl-io-error-info-bars.c:220 msgid "_Reload" msgstr "重新载入(_R)" #: tepl/tepl-io-error-info-bars.c:226 msgid "_Ignore" msgstr "忽略(_I)" #: tepl/tepl-io-error-info-bars.c:256 #, c-format msgid "The file “%s” has been externally modified." msgstr "文件“%s”已被外部程序更改。" #: tepl/tepl-io-error-info-bars.c:257 msgid "If you save it, all the external changes could be lost. Save it anyway?" msgstr "如果您保存它,所有的外部修改将丢失。仍然保存吗?" #: tepl/tepl-io-error-info-bars.c:303 #, c-format msgid "Some invalid characters have been detected while saving “%s”." msgstr "在保存“%s”时检测到了一些无效字符。" #: tepl/tepl-io-error-info-bars.c:309 msgid "" "If you continue saving this file you can corrupt the document. Save anyway?" msgstr "如果您继续保存此文件,您可能会损坏此文档。仍要保存吗?" #. chooser_dialog config #: tepl/tepl-language-chooser-dialog.c:125 msgid "Highlight Mode" msgstr "高亮模式" #: tepl/tepl-language-chooser-dialog.c:131 msgid "_Select" msgstr "选择(_S)" #: tepl/tepl-language-chooser-widget.c:76 msgid "Plain Text" msgstr "纯文本" #: tepl/tepl-language-chooser-widget.c:446 msgid "Search highlight mode…" msgstr "搜索高亮模式…" #. Translators: "Ln" is an abbreviation for "Line", Col is an #. * abbreviation for "Column". Please, use abbreviations if possible. #. #: tepl/tepl-line-column-indicator.c:49 #, c-format msgid "Ln %d, Col %d" msgstr "第 %d 行,第 %d 列" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:83 #, c-format msgid "The XML file must start with a element, not “%s”." msgstr "XML 文件必须以 元素而不是“%s”开始。" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:115 #, c-format msgid "Expected a element, got “%s” instead." msgstr "应为 元素,但读取到的是“%s”。" #. Translators: do not translate “atime”. #: tepl/tepl-metadata-parser.c:141 #, c-format msgid "Failed to parse the “atime” attribute value “%s”." msgstr "无法解析“atime”属性的值“%s”。" #. Translators: do not translate , “uri” and “atime”. #: tepl/tepl-metadata-parser.c:156 msgid "The element must contain the “uri” and “atime” attributes." msgstr " 元素必须包含“uri”和“atime”属性。" #. Translators: do not translate . #: tepl/tepl-metadata-parser.c:185 #, c-format msgid "Expected an element, got “%s” instead." msgstr "应为 元素,但读取到的是“%s”。" #. Translators: do not translate , “key” and “value”. #: tepl/tepl-metadata-parser.c:211 msgid "The element is missing the “key” or “value” attribute." msgstr " 元素缺少“key”或“value”属性。" #. Translators: "INS" is the abbreviation for "Insert", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:65 msgid "INS" msgstr "插入" #. Translators: "OVR" is the abbreviation for "Overwrite", for the text #. * cursor mode. The translation should be short too. #. #: tepl/tepl-overwrite-indicator.c:74 msgid "OVR" msgstr "覆盖" #: tepl/tepl-panel1.c:95 msgid "Hide panel" msgstr "隐藏面板" #: tepl/tepl-prefs.c:69 #, c-format msgid "_Use the system fixed width font (%s)" msgstr "使用系统等宽字体(%s)(_U)" #: tepl/tepl-prefs.c:137 msgid "Editor _font:" msgstr "编辑器字体(_F):" #: tepl/tepl-prefs.c:169 msgid "Font" msgstr "字体" #: tepl/tepl-prefs.c:188 msgid "_Display line numbers" msgstr "显示行号(_D)" #: tepl/tepl-prefs.c:218 msgid "_Tab width:" msgstr "制表符宽度(_T):" #: tepl/tepl-prefs.c:264 msgid "Insert _spaces instead of tabs" msgstr "使用空格代替制表符插入(_S)" #: tepl/tepl-prefs.c:268 msgid "_Forget you are not using tabulations" msgstr "忘记您并未使用制表符(_F)" #: tepl/tepl-prefs.c:317 msgid "Highlight current _line" msgstr "高亮当前行(_L)" #: tepl/tepl-prefs.c:321 msgid "Highlight matching _brackets" msgstr "高亮匹配括号(_B)" #: tepl/tepl-prefs.c:323 msgid "Highlighting" msgstr "高亮" #: tepl/tepl-prefs.c:347 msgid "_Autosave files" msgstr "自动保存文件(_A)" #: tepl/tepl-prefs.c:349 msgid "Time in _minutes between each autosave:" msgstr "自动保存间隔(分钟)(_M):" #: tepl/tepl-prefs.c:415 msgid "_Create a backup copy of files before saving" msgstr "保存前创建备份文件(_C)" #: tepl/tepl-prefs.c:421 msgid "Files" msgstr "文件" #: tepl/tepl-prefs.c:451 msgid "Follow system style" msgstr "跟随系统样式" #: tepl/tepl-prefs.c:454 msgid "Light style" msgstr "亮色样式" #: tepl/tepl-prefs.c:455 msgid "Dark style" msgstr "暗色样式" #: tepl/tepl-prefs.c:461 msgid "Theme Variant" msgstr "主题变种" #: tepl/tepl-prefs.c:494 msgid "Display right _margin at column:" msgstr "显示右边距线(列)(_M):" #: tepl/tepl-prefs.c:544 msgid "Display _statusbar" msgstr "显示状态栏(_S)" #: tepl/tepl-prefs-dialog.c:96 msgid "Preferences" msgstr "首选项" #: tepl/tepl-prefs-dialog.c:214 msgid "Do you really want to reset all preferences?" msgstr "您真的要重置所有首选项吗?" #: tepl/tepl-prefs-dialog.c:221 msgid "_Reset All" msgstr "全部重置(_R)" #: tepl/tepl-prefs-dialog.c:253 msgid "_Reset All…" msgstr "全部重置(_R)…" #: tepl/tepl-prefs-dialog.c:254 msgid "Reset all preferences" msgstr "重置所有首选项" #: tepl/tepl-space-drawer-prefs.c:190 tepl/tepl-space-drawer-prefs.c:192 #: tepl/tepl-space-drawer-prefs.c:194 msgid "Draw tabs" msgstr "绘制制表符" #: tepl/tepl-space-drawer-prefs.c:191 tepl/tepl-space-drawer-prefs.c:193 #: tepl/tepl-space-drawer-prefs.c:195 msgid "Draw spaces" msgstr "绘制空格" #: tepl/tepl-space-drawer-prefs.c:196 msgid "Draw new lines" msgstr "绘制新行" #: tepl/tepl-space-drawer-prefs.c:232 msgid "Leading Spaces" msgstr "起始空格" #: tepl/tepl-space-drawer-prefs.c:236 msgid "Spaces Inside Text" msgstr "文本中空格" #: tepl/tepl-space-drawer-prefs.c:240 msgid "Trailing Spaces" msgstr "末尾空格" #: tepl/tepl-space-drawer-prefs.c:260 msgid "Tab" msgstr "制表符" #: tepl/tepl-space-drawer-prefs.c:261 msgid "Space" msgstr "空格" #: tepl/tepl-space-drawer-prefs.c:262 msgid "No-Break Space" msgstr "无间断空格" #: tepl/tepl-space-drawer-prefs.c:263 msgid "Narrow No-Break Space" msgstr "窄无间断空格" #: tepl/tepl-space-drawer-prefs.c:282 msgid "Result" msgstr "结果" #: tepl/tepl-space-drawer-prefs.c:315 msgid "Information" msgstr "信息" #: tepl/tepl-space-drawer-prefs.c:317 msgid "" "When white space drawing is enabled, then non-breaking spaces are always " "drawn at all locations, to distinguish them from normal spaces." msgstr "启用绘制空白符时,无间断空格将总是在所有位置绘制以将其与正常空格区分。" #: tepl/tepl-style-scheme-chooser-full.c:90 msgid "Color Scheme for the Dark Theme Variant" msgstr "暗色主题变种的配色方案" #: tepl/tepl-style-scheme-chooser-full.c:94 msgid "Color Scheme for the Light Theme Variant" msgstr "亮色主题变种的配色方案" #: tepl/tepl-style-scheme-row.c:67 msgid "Unsupported for the dark theme variant" msgstr "不支持暗色主题变种" #: tepl/tepl-style-scheme-row.c:70 msgid "Unsupported for the light theme variant" msgstr "不支持亮色主题变种" #. Translators: location of a file. #: tepl/tepl-tab-label.c:249 msgid "Location:" msgstr "位置:" #: tepl/tepl-tab-label.c:318 msgid "Close file" msgstr "关闭文件" #: tepl/tepl-tab-loading.c:36 msgid "Error when loading the file." msgstr "载入文件时出错。" #: tepl/tepl-tab-saving.c:49 msgid "Error when saving the file." msgstr "保存文件时出错。" #: tepl/tepl-tab-saving.c:277 msgid "Save File" msgstr "保存文件" #. Create a GtkFileChooserDialog, not a GtkFileChooserNative, because #. * with GtkFileChooserNative the GFile that we obtain (in flatpak) #. * doesn't have the real path to the file, so it would ruin some #. * features for text editors: #. * - showing the directory in parentheses in the window title, or in the #. * tab tooltip; #. * - opening a recent file. #. * Basically everywhere where the directory is shown. #. #: tepl/tepl-window-actions-file.c:79 msgid "Open File" msgstr "打开文件" #~ msgid "Display _grid pattern" #~ msgstr "显示网格图案(_G)" #, c-format #~ msgid "Untitled File %d" #~ msgstr "无标题文件 %d" #~ msgid "_Don’t Edit" #~ msgstr "不编辑(_D)" libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/000077500000000000000000000000001526404732400231605ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/code-comment/000077500000000000000000000000001526404732400255325ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/code-comment/meson.build000066400000000000000000000013231526404732400276730ustar00rootroot00000000000000CODE_COMMENT_PUBLIC_HEADERS = files( 'tepl-code-comment.h', 'tepl-code-comment-view.h', ) CODE_COMMENT_PUBLIC_C_FILES = files( 'tepl-code-comment-view.c', ) code_comment_headers_install_dir = join_paths(get_option('includedir'), '@0@-@1@/tepl/code-comment/'.format(meson.project_name(), TEPL_API_VERSION)) install_headers( CODE_COMMENT_PUBLIC_HEADERS, install_dir: code_comment_headers_install_dir ) CODE_COMMENT_STATIC_LIB = static_library( 'code-comment-static', [CODE_COMMENT_PUBLIC_HEADERS, CODE_COMMENT_PUBLIC_C_FILES], pic: true, # this static lib is potentially linked in a shared library. include_directories: ROOT_INCLUDE_DIR, dependencies: TEPL_DEPS, c_args: '-DTEPL_COMPILATION', ) tepl-code-comment-view.c000066400000000000000000000553751526404732400321220ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/code-comment/* SPDX-FileCopyrightText: 2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-code-comment-view.h" #include "tepl/tepl-buffer.h" #include "tepl/tepl-signal-group.h" /** * SECTION:code-comment-view * @Title: TeplCodeCommentView * @Short_description: Code comment - GtkSourceView class extension * * #TeplCodeCommentView extends the #GtkSourceView class with the code comment * and uncomment feature. */ struct _TeplCodeCommentViewPrivate { /* Weak ref: a subclass of GtkSourceView can potentially own a strong * ref to a TeplCodeCommentView object. */ GtkSourceView *source_view; TeplSignalGroup *buffer_signal_group; }; enum { PROP_0, PROP_SOURCE_VIEW, PROP_CODE_COMMENT_IS_SUPPORTED, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplCodeCommentView, tepl_code_comment_view, G_TYPE_OBJECT) static void get_adjusted_selection_bounds (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end) { gtk_text_buffer_get_selection_bounds (buffer, start, end); /* See the note at tepl_code_comment_view_comment_lines(). */ if (tepl_buffer_get_selection_type (buffer) == TEPL_SELECTION_TYPE_MULTIPLE_LINES && gtk_text_iter_starts_line (end)) { gtk_text_iter_backward_line (end); } } static gboolean str_is_empty (const gchar *str) { return (str == NULL || str[0] == '\0'); } static gboolean str_contains_newline_char (const gchar *str) { g_assert (str != NULL); return (strchr (str, '\n') != NULL || strchr (str, '\r') != NULL); } static gboolean str_contains_leading_or_trailing_whitespace (const gchar *str, gboolean leading) { gchar *stripped_str; gboolean ret; g_assert (str != NULL); stripped_str = g_strdup (str); if (leading) { g_strchug (stripped_str); } else { g_strchomp (stripped_str); } ret = g_strcmp0 (stripped_str, str) != 0; g_free (stripped_str); return ret; } static gboolean str_contains_leading_whitespace (const gchar *str) { return str_contains_leading_or_trailing_whitespace (str, TRUE); } static gboolean str_contains_trailing_whitespace (const gchar *str) { return str_contains_leading_or_trailing_whitespace (str, FALSE); } static gboolean metadata_line_comment_start_is_valid (const gchar *str) { if (str_is_empty (str) || str_contains_newline_char (str) || str_contains_leading_whitespace (str)) { return FALSE; } return TRUE; } static gboolean metadata_block_comment_start_is_valid (const gchar *str) { return metadata_line_comment_start_is_valid (str); } static gboolean metadata_block_comment_end_is_valid (const gchar *str) { if (str_is_empty (str) || str_contains_newline_char (str) || str_contains_trailing_whitespace (str)) { return FALSE; } return TRUE; } static void warn_if_invalid_metadata (GtkSourceLanguage *language, const gchar *metadata_name, const gchar *metadata_value, gboolean metadata_value_is_valid) { if (metadata_value != NULL && !metadata_value_is_valid) { g_warning ("TeplCodeCommentView: language “%s”: %s metadata “%s” is not supported.", gtk_source_language_get_id (language), metadata_name, metadata_value); } } static void get_sanitized_metadata (GtkSourceLanguage *language, const gchar **line_comment_start, const gchar **block_comment_start, const gchar **block_comment_end) { gboolean line_comment_start_is_valid; gboolean block_comment_start_is_valid; gboolean block_comment_end_is_valid; *line_comment_start = gtk_source_language_get_metadata (language, "line-comment-start"); *block_comment_start = gtk_source_language_get_metadata (language, "block-comment-start"); *block_comment_end = gtk_source_language_get_metadata (language, "block-comment-end"); line_comment_start_is_valid = metadata_line_comment_start_is_valid (*line_comment_start); block_comment_start_is_valid = metadata_block_comment_start_is_valid (*block_comment_start); block_comment_end_is_valid = metadata_block_comment_end_is_valid (*block_comment_end); warn_if_invalid_metadata (language, "line-comment-start", *line_comment_start, line_comment_start_is_valid); warn_if_invalid_metadata (language, "block-comment-start", *block_comment_start, block_comment_start_is_valid); warn_if_invalid_metadata (language, "block-comment-end", *block_comment_end, block_comment_end_is_valid); if (!line_comment_start_is_valid) { *line_comment_start = NULL; } if (!block_comment_start_is_valid || !block_comment_end_is_valid) { *block_comment_start = NULL; *block_comment_end = NULL; } } static void language_notify_cb (GtkSourceBuffer *buffer, GParamSpec *pspec, TeplCodeCommentView *code_comment_view) { g_object_notify_by_pspec (G_OBJECT (code_comment_view), properties[PROP_CODE_COMMENT_IS_SUPPORTED]); } static void buffer_changed (TeplCodeCommentView *code_comment_view) { GtkSourceBuffer *buffer; tepl_signal_group_clear (&code_comment_view->priv->buffer_signal_group); g_object_notify_by_pspec (G_OBJECT (code_comment_view), properties[PROP_CODE_COMMENT_IS_SUPPORTED]); if (code_comment_view->priv->source_view == NULL) { return; } buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (code_comment_view->priv->source_view))); code_comment_view->priv->buffer_signal_group = tepl_signal_group_new (G_OBJECT (buffer)); tepl_signal_group_add (code_comment_view->priv->buffer_signal_group, g_signal_connect (buffer, "notify::language", G_CALLBACK (language_notify_cb), code_comment_view)); } static void buffer_notify_cb (GtkTextView *view, GParamSpec *pspec, TeplCodeCommentView *code_comment_view) { buffer_changed (code_comment_view); } static void editable_notify_cb (GtkTextView *view, GParamSpec *pspec, TeplCodeCommentView *code_comment_view) { g_object_notify_by_pspec (G_OBJECT (code_comment_view), properties[PROP_CODE_COMMENT_IS_SUPPORTED]); } static void set_source_view (TeplCodeCommentView *code_comment_view, GtkSourceView *source_view) { if (source_view == NULL) { return; } g_return_if_fail (GTK_SOURCE_IS_VIEW (source_view)); g_assert (code_comment_view->priv->source_view == NULL); g_set_weak_pointer (&code_comment_view->priv->source_view, source_view); g_signal_connect_object (source_view, "notify::buffer", G_CALLBACK (buffer_notify_cb), code_comment_view, G_CONNECT_DEFAULT); g_signal_connect_object (source_view, "notify::editable", G_CALLBACK (editable_notify_cb), code_comment_view, G_CONNECT_DEFAULT); buffer_changed (code_comment_view); } static void tepl_code_comment_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplCodeCommentView *code_comment_view = TEPL_CODE_COMMENT_VIEW (object); switch (prop_id) { case PROP_SOURCE_VIEW: g_value_set_object (value, tepl_code_comment_view_get_source_view (code_comment_view)); break; case PROP_CODE_COMMENT_IS_SUPPORTED: g_value_set_boolean (value, tepl_code_comment_view_code_comment_is_supported (code_comment_view)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_code_comment_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplCodeCommentView *code_comment_view = TEPL_CODE_COMMENT_VIEW (object); switch (prop_id) { case PROP_SOURCE_VIEW: set_source_view (code_comment_view, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_code_comment_view_dispose (GObject *object) { TeplCodeCommentView *code_comment_view = TEPL_CODE_COMMENT_VIEW (object); g_clear_weak_pointer (&code_comment_view->priv->source_view); tepl_signal_group_clear (&code_comment_view->priv->buffer_signal_group); G_OBJECT_CLASS (tepl_code_comment_view_parent_class)->dispose (object); } static void tepl_code_comment_view_class_init (TeplCodeCommentViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_code_comment_view_get_property; object_class->set_property = tepl_code_comment_view_set_property; object_class->dispose = tepl_code_comment_view_dispose; /** * TeplCodeCommentView:source-view: * * The associated #GtkSourceView widget. #TeplCodeCommentView has a weak * reference to the #GtkSourceView. * * Since: 6.14 */ properties[PROP_SOURCE_VIEW] = g_param_spec_object ("source-view", "source-view", "", GTK_SOURCE_TYPE_VIEW, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplCodeCommentView:code-comment-is-supported: * * Whether code comment/uncomment is supported. * * This property is %TRUE when all these conditions are met: * - The necessary metadata is available, to know what character or * string to insert or remove. * - The #GtkTextView:editable property is %TRUE. * * Since: 6.14 */ properties[PROP_CODE_COMMENT_IS_SUPPORTED] = g_param_spec_boolean ("code-comment-is-supported", "code-comment-is-supported", "", FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_code_comment_view_init (TeplCodeCommentView *code_comment_view) { code_comment_view->priv = tepl_code_comment_view_get_instance_private (code_comment_view); } /** * tepl_code_comment_view_new: * @view: a #GtkSourceView widget. * * Returns: (transfer full): a new #TeplCodeCommentView object. * Since: 6.14 */ TeplCodeCommentView * tepl_code_comment_view_new (GtkSourceView *view) { g_return_val_if_fail (GTK_SOURCE_IS_VIEW (view), NULL); return g_object_new (TEPL_TYPE_CODE_COMMENT_VIEW, "source-view", view, NULL); } /** * tepl_code_comment_view_get_source_view: * @code_comment_view: a #TeplCodeCommentView. * * Returns: (transfer none) (nullable): the #TeplCodeCommentView:source-view. * Since: 6.14 */ GtkSourceView * tepl_code_comment_view_get_source_view (TeplCodeCommentView *code_comment_view) { g_return_val_if_fail (TEPL_IS_CODE_COMMENT_VIEW (code_comment_view), NULL); return code_comment_view->priv->source_view; } /** * tepl_code_comment_view_code_comment_is_supported: * @code_comment_view: a #TeplCodeCommentView. * * Returns: the current value of the * #TeplCodeCommentView:code-comment-is-supported property. * Since: 6.14 */ gboolean tepl_code_comment_view_code_comment_is_supported (TeplCodeCommentView *code_comment_view) { GtkSourceBuffer *buffer; GtkSourceLanguage *language; const gchar *line_comment_start; const gchar *block_comment_start; const gchar *block_comment_end; g_return_val_if_fail (TEPL_IS_CODE_COMMENT_VIEW (code_comment_view), FALSE); if (code_comment_view->priv->source_view == NULL) { return FALSE; } if (!gtk_text_view_get_editable (GTK_TEXT_VIEW (code_comment_view->priv->source_view))) { return FALSE; } buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (code_comment_view->priv->source_view))); language = gtk_source_buffer_get_language (buffer); if (language == NULL) { return FALSE; } get_sanitized_metadata (language, &line_comment_start, &block_comment_start, &block_comment_end); return ((line_comment_start != NULL) || (block_comment_start != NULL && block_comment_end != NULL)); } static void comment_single_line (GtkTextBuffer *buffer, gint line_num, const gchar *line_comment_start, const gchar *block_comment_start, const gchar *block_comment_end) { GtkTextIter iter; gtk_text_buffer_get_iter_at_line (buffer, &iter, line_num); g_return_if_fail (gtk_text_iter_get_line (&iter) == line_num); if (line_comment_start != NULL) { gtk_text_buffer_insert (buffer, &iter, line_comment_start, -1); } /* Don't insert block-comment-start/end on empty lines. For example with * XML/HTML it would clutter the view. * On the other hand, for line-comment-start it's nice to have a * vertical "line" of comment chars, to better see what has been * commented out. */ else if (!gtk_text_iter_ends_line (&iter)) { gtk_text_buffer_insert (buffer, &iter, block_comment_start, -1); gtk_text_iter_forward_to_line_end (&iter); g_return_if_fail (gtk_text_iter_get_line (&iter) == line_num); gtk_text_buffer_insert (buffer, &iter, block_comment_end, -1); } } /** * tepl_code_comment_view_comment_lines: * @code_comment_view: a #TeplCodeCommentView. * @start_iter: a #GtkTextIter. * @end_iter: (nullable): a #GtkTextIter, or %NULL to comment only the line at * @start_iter. * * Comments the lines between @start_iter and @end_iter included. * * If @end_iter is %NULL, only a single line is commented. * * Ensure that code comment is supported before calling this function. See * tepl_code_comment_view_code_comment_is_supported(). * * Note that @end_iter is always included and its line will be commented, even * if it starts the line. In the case where @end_iter starts the line, and if * @start_iter and @end_iter are the selection bounds, it is not visible in the * #GtkTextView widget that @end_iter is “selected” (the previous line is fully * selected, but there are no indications at @end_iter per se). You may thus * need to adjust @end_iter before calling this function, to follow well users' * expectations. * * Since: 6.14 */ /* API design: * For @end_iter which is always included: we prefer this more predictable * behavior instead of applying a “smart” behavior depending on whether * @end_iter starts a line or not. */ void tepl_code_comment_view_comment_lines (TeplCodeCommentView *code_comment_view, const GtkTextIter *start_iter, const GtkTextIter *end_iter) { GtkSourceBuffer *buffer; GtkSourceLanguage *language; const gchar *line_comment_start; const gchar *block_comment_start; const gchar *block_comment_end; GtkTextIter my_start_iter; GtkTextIter my_end_iter; gint start_line; gint end_line; gint line_num; g_return_if_fail (TEPL_IS_CODE_COMMENT_VIEW (code_comment_view)); if (code_comment_view->priv->source_view == NULL) { return; } buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (code_comment_view->priv->source_view))); g_return_if_fail (start_iter != NULL); g_return_if_fail (gtk_text_iter_get_buffer (start_iter) == GTK_TEXT_BUFFER (buffer)); g_return_if_fail (end_iter == NULL || gtk_text_iter_get_buffer (end_iter) == GTK_TEXT_BUFFER (buffer)); g_return_if_fail (tepl_code_comment_view_code_comment_is_supported (code_comment_view)); language = gtk_source_buffer_get_language (buffer); get_sanitized_metadata (language, &line_comment_start, &block_comment_start, &block_comment_end); my_start_iter = *start_iter; my_end_iter = end_iter != NULL ? *end_iter : *start_iter; gtk_text_iter_order (&my_start_iter, &my_end_iter); start_line = gtk_text_iter_get_line (&my_start_iter); end_line = gtk_text_iter_get_line (&my_end_iter); gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (buffer)); for (line_num = start_line; line_num <= end_line; line_num++) { comment_single_line (GTK_TEXT_BUFFER (buffer), line_num, line_comment_start, block_comment_start, block_comment_end); } gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer)); } /** * tepl_code_comment_view_comment_selected_lines: * @code_comment_view: a #TeplCodeCommentView. * * Comments the selected lines. * * Ensure that code comment is supported before calling this function. See * tepl_code_comment_view_code_comment_is_supported(). * * Since: 6.14 */ void tepl_code_comment_view_comment_selected_lines (TeplCodeCommentView *code_comment_view) { GtkTextBuffer *buffer; GtkTextIter start; GtkTextIter end; g_return_if_fail (TEPL_IS_CODE_COMMENT_VIEW (code_comment_view)); if (code_comment_view->priv->source_view == NULL) { return; } buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (code_comment_view->priv->source_view)); get_adjusted_selection_bounds (buffer, &start, &end); tepl_code_comment_view_comment_lines (code_comment_view, &start, &end); } static gboolean uncomment_line_with_line_comment_start (GtkTextBuffer *buffer, gint line_num, const gchar *line_comment_start) { GtkTextIter iter; GtkTextIter leading_end; GtkTextIter match_end; gtk_text_buffer_get_iter_at_line (buffer, &iter, line_num); g_return_val_if_fail (gtk_text_iter_get_line (&iter) == line_num, FALSE); gtk_source_iter_get_leading_spaces_end_boundary (&iter, &leading_end); if (gtk_source_iter_starts_string (&leading_end, line_comment_start, &match_end) && gtk_text_iter_get_line (&match_end) == line_num) { gtk_text_buffer_delete (buffer, &leading_end, &match_end); return TRUE; } return FALSE; } static gboolean uncomment_line_by_line_with_line_comment_start (GtkTextBuffer *buffer, gint start_line, gint end_line, const gchar *line_comment_start) { gint line_num; gboolean success = FALSE; if (line_comment_start == NULL) { return FALSE; } for (line_num = start_line; line_num <= end_line; line_num++) { if (uncomment_line_with_line_comment_start (buffer, line_num, line_comment_start)) { success = TRUE; } } return success; } static gboolean uncomment_line_with_block_comments (GtkTextBuffer *buffer, gint line_num, const gchar *block_comment_start, const gchar *block_comment_end) { GtkTextIter at_start_of_line; GtkTextIter leading_end; GtkTextIter trailing_start; GtkTextIter end_of_block_comment_start; GtkTextIter start_of_block_comment_end; gboolean block_comment_start_found; gboolean block_comment_end_found; gtk_text_buffer_get_iter_at_line (buffer, &at_start_of_line, line_num); g_return_val_if_fail (gtk_text_iter_get_line (&at_start_of_line) == line_num, FALSE); gtk_source_iter_get_leading_spaces_end_boundary (&at_start_of_line, &leading_end); gtk_source_iter_get_trailing_spaces_start_boundary (&at_start_of_line, &trailing_start); block_comment_start_found = gtk_source_iter_starts_string (&leading_end, block_comment_start, &end_of_block_comment_start); block_comment_end_found = gtk_source_iter_ends_string (&trailing_start, block_comment_end, &start_of_block_comment_end); if (block_comment_start_found && block_comment_end_found) { GtkTextMark *mark_for_start_of_block_comment_end; GtkTextMark *mark_for_trailing_start; g_return_val_if_fail (gtk_text_iter_get_line (&leading_end) == line_num, FALSE); g_return_val_if_fail (gtk_text_iter_get_line (&end_of_block_comment_start) == line_num, FALSE); g_return_val_if_fail (gtk_text_iter_get_line (&start_of_block_comment_end) == line_num, FALSE); g_return_val_if_fail (gtk_text_iter_get_line (&trailing_start) == line_num, FALSE); g_return_val_if_fail (gtk_text_iter_compare (&leading_end, &end_of_block_comment_start) < 0, FALSE); g_return_val_if_fail (gtk_text_iter_compare (&start_of_block_comment_end, &trailing_start) < 0, FALSE); // Overlap. This can happen with /*/ in C :-) if (gtk_text_iter_compare (&end_of_block_comment_start, &start_of_block_comment_end) > 0) { return FALSE; } mark_for_start_of_block_comment_end = gtk_text_buffer_create_mark (buffer, NULL, &start_of_block_comment_end, TRUE); mark_for_trailing_start = gtk_text_buffer_create_mark (buffer, NULL, &trailing_start, TRUE); gtk_text_buffer_delete (buffer, &leading_end, &end_of_block_comment_start); gtk_text_buffer_get_iter_at_mark (buffer, &start_of_block_comment_end, mark_for_start_of_block_comment_end); gtk_text_buffer_get_iter_at_mark (buffer, &trailing_start, mark_for_trailing_start); gtk_text_buffer_delete_mark (buffer, mark_for_start_of_block_comment_end); gtk_text_buffer_delete_mark (buffer, mark_for_trailing_start); gtk_text_buffer_delete (buffer, &start_of_block_comment_end, &trailing_start); return TRUE; } return FALSE; } static gboolean uncomment_line_by_line_with_block_comments (GtkTextBuffer *buffer, gint start_line, gint end_line, const gchar *block_comment_start, const gchar *block_comment_end) { gint line_num; gboolean success = FALSE; if (block_comment_start == NULL || block_comment_end == NULL) { return FALSE; } for (line_num = start_line; line_num <= end_line; line_num++) { if (uncomment_line_with_block_comments (buffer, line_num, block_comment_start, block_comment_end)) { success = TRUE; } } return success; } /** * tepl_code_comment_view_uncomment_selection: * @code_comment_view: a #TeplCodeCommentView. * * Uncomments the selected text. * * Ensure that code comment is supported before calling this function. See * tepl_code_comment_view_code_comment_is_supported(). * * Since: 6.14 */ void tepl_code_comment_view_uncomment_selection (TeplCodeCommentView *code_comment_view) { GtkSourceBuffer *buffer; GtkSourceLanguage *language; const gchar *line_comment_start; const gchar *block_comment_start; const gchar *block_comment_end; GtkTextIter selection_start; GtkTextIter selection_end; gint start_line; gint end_line; gboolean done; g_return_if_fail (TEPL_IS_CODE_COMMENT_VIEW (code_comment_view)); if (code_comment_view->priv->source_view == NULL) { return; } g_return_if_fail (tepl_code_comment_view_code_comment_is_supported (code_comment_view)); buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (code_comment_view->priv->source_view))); language = gtk_source_buffer_get_language (buffer); get_sanitized_metadata (language, &line_comment_start, &block_comment_start, &block_comment_end); get_adjusted_selection_bounds (GTK_TEXT_BUFFER (buffer), &selection_start, &selection_end); start_line = gtk_text_iter_get_line (&selection_start); end_line = gtk_text_iter_get_line (&selection_end); gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (buffer)); done = uncomment_line_by_line_with_line_comment_start (GTK_TEXT_BUFFER (buffer), start_line, end_line, line_comment_start); if (!done) { uncomment_line_by_line_with_block_comments (GTK_TEXT_BUFFER (buffer), start_line, end_line, block_comment_start, block_comment_end); } gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer)); } tepl-code-comment-view.h000066400000000000000000000044151526404732400321140ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/code-comment/* SPDX-FileCopyrightText: 2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_CODE_COMMENT_VIEW_H #define TEPL_CODE_COMMENT_VIEW_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_CODE_COMMENT_VIEW (tepl_code_comment_view_get_type ()) #define TEPL_CODE_COMMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_CODE_COMMENT_VIEW, TeplCodeCommentView)) #define TEPL_CODE_COMMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_CODE_COMMENT_VIEW, TeplCodeCommentViewClass)) #define TEPL_IS_CODE_COMMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_CODE_COMMENT_VIEW)) #define TEPL_IS_CODE_COMMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_CODE_COMMENT_VIEW)) #define TEPL_CODE_COMMENT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_CODE_COMMENT_VIEW, TeplCodeCommentViewClass)) typedef struct _TeplCodeCommentView TeplCodeCommentView; typedef struct _TeplCodeCommentViewClass TeplCodeCommentViewClass; typedef struct _TeplCodeCommentViewPrivate TeplCodeCommentViewPrivate; struct _TeplCodeCommentView { GObject parent; TeplCodeCommentViewPrivate *priv; }; struct _TeplCodeCommentViewClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_code_comment_view_get_type (void); G_MODULE_EXPORT TeplCodeCommentView * tepl_code_comment_view_new (GtkSourceView *view); G_MODULE_EXPORT GtkSourceView * tepl_code_comment_view_get_source_view (TeplCodeCommentView *code_comment_view); G_MODULE_EXPORT gboolean tepl_code_comment_view_code_comment_is_supported (TeplCodeCommentView *code_comment_view); G_MODULE_EXPORT void tepl_code_comment_view_comment_lines (TeplCodeCommentView *code_comment_view, const GtkTextIter *start_iter, const GtkTextIter *end_iter); G_MODULE_EXPORT void tepl_code_comment_view_comment_selected_lines (TeplCodeCommentView *code_comment_view); G_MODULE_EXPORT void tepl_code_comment_view_uncomment_selection (TeplCodeCommentView *code_comment_view); G_END_DECLS #endif /* TEPL_CODE_COMMENT_VIEW_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/code-comment/tepl-code-comment.h000066400000000000000000000005621526404732400312220ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_CODE_COMMENT_H #define TEPL_CODE_COMMENT_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #endif /* TEPL_CODE_COMMENT_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/meson.build000066400000000000000000000133461526404732400253310ustar00rootroot00000000000000subdir('code-comment') tepl_public_headers = [ 'tepl.h', 'tepl-abstract-factory.h', 'tepl-application.h', 'tepl-application-window.h', 'tepl-buffer.h', 'tepl-file.h', 'tepl-file-chooser.h', 'tepl-file-loader.h', 'tepl-file-saver.h', 'tepl-fold-region.h', 'tepl-goto-line-bar.h', 'tepl-gutter-renderer-folds.h', 'tepl-info-bar.h', 'tepl-init.h', 'tepl-io-error-info-bars.h', 'tepl-language-chooser.h', 'tepl-language-chooser-dialog.h', 'tepl-language-chooser-widget.h', 'tepl-line-column-indicator.h', 'tepl-menu-shell.h', 'tepl-metadata.h', 'tepl-metadata-manager.h', 'tepl-notebook.h', 'tepl-object-counters.h', 'tepl-overwrite-indicator.h', 'tepl-panel1.h', 'tepl-panel.h', 'tepl-panel-item.h', 'tepl-panel-notebook.h', 'tepl-panel-simple.h', 'tepl-panel-stack.h', 'tepl-panel-switcher-menu.h', 'tepl-pango.h', 'tepl-prefs.h', 'tepl-prefs-dialog.h', 'tepl-progress-info-bar.h', 'tepl-settings.h', 'tepl-settings-binding-group.h', 'tepl-signal-group.h', 'tepl-space-drawer-prefs.h', 'tepl-statusbar.h', 'tepl-status-menu-button.h', 'tepl-style-scheme-chooser-full.h', 'tepl-style-scheme-chooser-simple.h', 'tepl-tab.h', 'tepl-tab-group.h', 'tepl-tab-label.h', 'tepl-tab-loading.h', 'tepl-tab-saving.h', 'tepl-utils.h', 'tepl-view.h', 'tepl-window-state.h', ] tepl_public_c_files = [ 'tepl-abstract-factory.c', 'tepl-application.c', 'tepl-application-window.c', 'tepl-buffer.c', 'tepl-file.c', 'tepl-file-chooser.c', 'tepl-file-loader.c', 'tepl-file-saver.c', 'tepl-fold-region.c', 'tepl-goto-line-bar.c', 'tepl-gutter-renderer-folds.c', 'tepl-info-bar.c', 'tepl-init.c', 'tepl-io-error-info-bars.c', 'tepl-language-chooser.c', 'tepl-language-chooser-dialog.c', 'tepl-language-chooser-widget.c', 'tepl-line-column-indicator.c', 'tepl-menu-shell.c', 'tepl-metadata.c', 'tepl-metadata-manager.c', 'tepl-notebook.c', 'tepl-object-counters.c', 'tepl-overwrite-indicator.c', 'tepl-panel1.c', 'tepl-panel.c', 'tepl-panel-item.c', 'tepl-panel-notebook.c', 'tepl-panel-simple.c', 'tepl-panel-stack.c', 'tepl-panel-switcher-menu.c', 'tepl-pango.c', 'tepl-prefs.c', 'tepl-prefs-dialog.c', 'tepl-progress-info-bar.c', 'tepl-settings.c', 'tepl-settings-binding-group.c', 'tepl-signal-group.c', 'tepl-space-drawer-prefs.c', 'tepl-statusbar.c', 'tepl-status-menu-button.c', 'tepl-style-scheme-chooser-full.c', 'tepl-style-scheme-chooser-simple.c', 'tepl-tab.c', 'tepl-tab-group.c', 'tepl-tab-label.c', 'tepl-tab-loading.c', 'tepl-tab-saving.c', 'tepl-utils.c', 'tepl-view.c', 'tepl-window-state.c', ] TEPL_PRIVATE_HEADERS = [ 'tepl-close-confirm-dialog-single.h', 'tepl-icu.h', 'tepl-metadata-attic.h', 'tepl-metadata-parser.h', 'tepl-style-scheme-row.h', 'tepl-window-actions-edit.h', 'tepl-window-actions-file.h', 'tepl-window-actions-search.h' ] tepl_private_c_files = [ 'tepl-close-confirm-dialog-single.c', 'tepl-icu.c', 'tepl-metadata-attic.c', 'tepl-metadata-parser.c', 'tepl-style-scheme-row.c', 'tepl-window-actions-edit.c', 'tepl-window-actions-file.c', 'tepl-window-actions-search.c' ] headers_install_dir = get_option('includedir') / '@0@-@1@/tepl/'.format(meson.project_name(), TEPL_API_VERSION) install_headers( tepl_public_headers, install_dir: headers_install_dir ) tepl_enum_types = GNOME.mkenums_simple( 'tepl-enum-types', decorator: 'G_MODULE_EXPORT', header_prefix: '#include ', sources: tepl_public_headers, install_header: true, install_dir: headers_install_dir ) tepl_static_lib = static_library( 'tepl-static', [tepl_public_c_files, tepl_private_c_files, tepl_enum_types], pic: true, # tepl_static_lib is linked in a shared library. include_directories: ROOT_INCLUDE_DIR, dependencies: TEPL_DEPS, c_args: '-DTEPL_COMPILATION' ) # For unit tests, to be able to test private functions. TEPL_STATIC_DEP = declare_dependency( include_directories: ROOT_INCLUDE_DIR, link_with: [ tepl_static_lib, CODE_COMMENT_STATIC_LIB, ], sources: tepl_enum_types[1], dependencies: TEPL_DEPS ) symbol_map = 'symbol.map' tepl_lib_link_args = c_compiler.get_supported_link_arguments([ '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbol_map), ]) tepl_lib = library( 'gedit-tepl-@0@'.format(TEPL_API_VERSION), dependencies: TEPL_DEPS, link_args: tepl_lib_link_args, link_depends: symbol_map, # link_whole is not supported with MSVC, so we use extract_all_objects(). objects: [ tepl_static_lib.extract_all_objects(recursive: false), CODE_COMMENT_STATIC_LIB.extract_all_objects(recursive: false), ], soversion: SOVERSION, install: true ) TEPL_LIB_DEP = declare_dependency( include_directories: ROOT_INCLUDE_DIR, link_with: tepl_lib, sources: tepl_enum_types[1], dependencies: TEPL_DEPS ) PKG_CONFIG.generate(tepl_lib, filebase: '@0@-@1@'.format(meson.project_name(), TEPL_API_VERSION), name: meson.project_name(), description: 'Text editor product line', subdirs: '@0@-@1@'.format(meson.project_name(), TEPL_API_VERSION), libraries: TEPL_PUBLIC_DEPS, ) if get_option('gobject_introspection') GNOME.generate_gir( tepl_lib, export_packages: '@0@-@1@'.format(meson.project_name(), TEPL_API_VERSION), header: 'tepl/tepl.h', identifier_prefix: 'Tepl', include_directories: ROOT_INCLUDE_DIR, includes: ['Gtk-3.0', 'GtkSource-300', 'Amtk-5'], install: true, namespace: 'Tepl', nsversion: TEPL_API_VERSION, sources: [ tepl_public_headers, tepl_public_c_files, tepl_enum_types, CODE_COMMENT_PUBLIC_HEADERS, CODE_COMMENT_PUBLIC_C_FILES, ], # Support for deps being built as subprojects: dependencies: TEPL_DEPS, ) endif libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/symbol.map000066400000000000000000000000431526404732400251610ustar00rootroot00000000000000{ global: tepl_*; local: *; }; libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-abstract-factory.c000066400000000000000000000201121526404732400275320ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-abstract-factory.h" #include "tepl-tab-label.h" /** * SECTION:abstract-factory * @Short_description: Abstract factory singleton class * @Title: TeplAbstractFactory * * Tepl uses the #TeplAbstractFactory singleton to create some objects and * widgets. By creating a subclass of #TeplAbstractFactory (to override the * desired virtual functions) and setting the instance with * tepl_abstract_factory_set_singleton(), an application can tell Tepl to create * custom objects and widgets. * * Note that #GtkTextViewClass has the ::create_buffer factory method, that * #TeplView overrides to create a #TeplBuffer. How the #TeplView and * #TeplBuffer are created can be customized with the ::create_tab vfunc of * #TeplAbstractFactory. * * Recommendation for the subclass name: in Tepl, #TeplAbstractFactory is an * abstract class, but in an application it is a concrete class. So * “MyappFactory” is a better name than “MyappAbstractFactory”. */ /* API design: * * An example of another sub-classable singleton is PeasEngine, in libpeas. I * didn't really like the PeasEngine implementation with get_default(), so I've * implemented TeplAbstractFactory differently. * tepl_abstract_factory_set_singleton() is more explicit. And doing things * explicitly is clearer. -- swilmet */ static TeplAbstractFactory *singleton = NULL; G_DEFINE_TYPE (TeplAbstractFactory, tepl_abstract_factory, G_TYPE_OBJECT) static void tepl_abstract_factory_finalize (GObject *object) { if (singleton == TEPL_ABSTRACT_FACTORY (object)) { singleton = NULL; } G_OBJECT_CLASS (tepl_abstract_factory_parent_class)->finalize (object); } static TeplTab * tepl_abstract_factory_create_tab_default (TeplAbstractFactory *factory) { return tepl_tab_new (); } static GtkWidget * tepl_abstract_factory_create_tab_label_default (TeplAbstractFactory *factory, TeplTab *tab) { return tepl_tab_label_new (tab); } static TeplFile * tepl_abstract_factory_create_file_default (TeplAbstractFactory *factory) { return tepl_file_new (); } static TeplPrefsDialog * tepl_abstract_factory_create_prefs_dialog_default (TeplAbstractFactory *factory) { return tepl_prefs_dialog_new (); } static void tepl_abstract_factory_class_init (TeplAbstractFactoryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = tepl_abstract_factory_finalize; klass->create_tab = tepl_abstract_factory_create_tab_default; klass->create_tab_label = tepl_abstract_factory_create_tab_label_default; klass->create_file = tepl_abstract_factory_create_file_default; klass->create_prefs_dialog = tepl_abstract_factory_create_prefs_dialog_default; } static void tepl_abstract_factory_init (TeplAbstractFactory *factory) { } /** * tepl_abstract_factory_set_singleton: * @factory: (transfer full): a #TeplAbstractFactory. * * Sets the #TeplAbstractFactory singleton. This should be called early in * main(), for example just after calling tepl_init(). * * This function must be called only once, before the first call to * tepl_abstract_factory_get_singleton(). * * Tepl takes ownership of the @factory reference. * * Since: 3.0 */ void tepl_abstract_factory_set_singleton (TeplAbstractFactory *factory) { g_return_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory)); if (singleton != NULL) { g_warning ("%s(): the TeplAbstractFactory singleton is already created.", G_STRFUNC); return; } singleton = factory; } /** * tepl_abstract_factory_get_singleton: * * Gets the #TeplAbstractFactory singleton instance. * * If tepl_abstract_factory_set_singleton() has not been called, the singleton * is created with a #TeplAbstractFactory instance. * * Returns: (transfer none): the #TeplAbstractFactory singleton instance. * Since: 3.0 */ TeplAbstractFactory * tepl_abstract_factory_get_singleton (void) { if (G_UNLIKELY (singleton == NULL)) { singleton = g_object_new (TEPL_TYPE_ABSTRACT_FACTORY, NULL); } return singleton; } void _tepl_abstract_factory_unref_singleton (void) { if (singleton != NULL) { g_object_unref (singleton); } /* singleton is not set to NULL here, it is set to NULL in * tepl_abstract_factory_finalize() (i.e. when we are sure that the ref * count reaches 0). */ } /** * tepl_abstract_factory_create_main_window: * @factory: the #TeplAbstractFactory. * @app: a #GtkApplication. * * Creates a main #GtkApplicationWindow in the sense of * tepl_application_window_is_main_window(). * * Returns: (transfer floating) (nullable): a new main application window, or * %NULL if the vfunc is not implemented. */ GtkApplicationWindow * tepl_abstract_factory_create_main_window (TeplAbstractFactory *factory, GtkApplication *app) { g_return_val_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory), NULL); g_return_val_if_fail (GTK_IS_APPLICATION (app), NULL); if (TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_main_window != NULL) { return TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_main_window (factory, app); } g_warning ("The TeplAbstractFactory::create_main_window vfunc is not implemented."); return NULL; } /** * tepl_abstract_factory_create_tab: * @factory: the #TeplAbstractFactory. * * Returns: (transfer floating): a new #TeplTab. * Since: 3.0 */ TeplTab * tepl_abstract_factory_create_tab (TeplAbstractFactory *factory) { g_return_val_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory), NULL); return TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_tab (factory); } /** * tepl_abstract_factory_create_tab_label: * @factory: the #TeplAbstractFactory. * @tab: a #TeplTab. * * Creates a new tab label for @tab, suitable for gtk_notebook_set_tab_label(). * * Returns: (transfer floating) (nullable): a new #GtkWidget, or %NULL for the * default tab label (“page N” with #GtkNotebook). * Since: 3.0 */ GtkWidget * tepl_abstract_factory_create_tab_label (TeplAbstractFactory *factory, TeplTab *tab) { g_return_val_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory), NULL); g_return_val_if_fail (TEPL_IS_TAB (tab), NULL); return TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_tab_label (factory, tab); } /** * tepl_abstract_factory_create_file: * @factory: the #TeplAbstractFactory. * * Returns: (transfer full): a new #TeplFile. * Since: 4.0 */ TeplFile * tepl_abstract_factory_create_file (TeplAbstractFactory *factory) { g_return_val_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory), NULL); return TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_file (factory); } /** * tepl_abstract_factory_create_metadata_manager_file: * @factory: the #TeplAbstractFactory. * * Creates a new #GFile that is then intended to be used as an argument to * tepl_metadata_manager_load_from_disk() and * tepl_metadata_manager_save_to_disk(). This function just creates the #GFile * object, it doesn't call any #TeplMetadataManager function. * * Returns: (transfer full) (nullable): a new #GFile, or %NULL if the vfunc is * not implemented. * Since: 5.0 */ GFile * tepl_abstract_factory_create_metadata_manager_file (TeplAbstractFactory *factory) { g_return_val_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory), NULL); if (TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_metadata_manager_file != NULL) { return TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_metadata_manager_file (factory); } g_warning ("The TeplAbstractFactory::create_metadata_manager_file vfunc is not implemented."); return NULL; } /** * tepl_abstract_factory_create_prefs_dialog: * @factory: the #TeplAbstractFactory. * * Returns: (transfer floating) (nullable): a new #TeplPrefsDialog, or %NULL if * the vfunc is not implemented. * Since: 6.13 */ TeplPrefsDialog * tepl_abstract_factory_create_prefs_dialog (TeplAbstractFactory *factory) { g_return_val_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory), NULL); if (TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_prefs_dialog != NULL) { return TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_prefs_dialog (factory); } g_warning ("The TeplAbstractFactory::create_prefs_dialog vfunc is not implemented."); return NULL; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-abstract-factory.h000066400000000000000000000076631526404732400275570ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_ABSTRACT_FACTORY_H #define TEPL_ABSTRACT_FACTORY_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include #include #include G_BEGIN_DECLS #define TEPL_TYPE_ABSTRACT_FACTORY (tepl_abstract_factory_get_type ()) #define TEPL_ABSTRACT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_ABSTRACT_FACTORY, TeplAbstractFactory)) #define TEPL_ABSTRACT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_ABSTRACT_FACTORY, TeplAbstractFactoryClass)) #define TEPL_IS_ABSTRACT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_ABSTRACT_FACTORY)) #define TEPL_IS_ABSTRACT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_ABSTRACT_FACTORY)) #define TEPL_ABSTRACT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_ABSTRACT_FACTORY, TeplAbstractFactoryClass)) typedef struct _TeplAbstractFactory TeplAbstractFactory; typedef struct _TeplAbstractFactoryClass TeplAbstractFactoryClass; struct _TeplAbstractFactory { GObject parent; }; /** * TeplAbstractFactoryClass: * @parent_class: The parent class. * @create_main_window: Virtual function pointer for * tepl_abstract_factory_create_main_window(). It is not implemented by * default. * @create_tab: Virtual function pointer for tepl_abstract_factory_create_tab(). * By default the #TeplTab is created with tepl_tab_new(). * @create_tab_label: Virtual function pointer for * tepl_abstract_factory_create_tab_label(). By default the tab label is * created with tepl_tab_label_new(). * @create_file: Virtual function pointer for * tepl_abstract_factory_create_file(). By default the #TeplFile is created * with tepl_file_new(). * @create_metadata_manager_file: Virtual function pointer for * tepl_abstract_factory_create_metadata_manager_file(). It is not implemented * by default. * @create_prefs_dialog: Virtual function pointer for * tepl_abstract_factory_create_prefs_dialog(). By default the * #TeplPrefsDialog is created with tepl_prefs_dialog_new(). */ struct _TeplAbstractFactoryClass { GObjectClass parent_class; GtkApplicationWindow * (* create_main_window) (TeplAbstractFactory *factory, GtkApplication *app); TeplTab * (* create_tab) (TeplAbstractFactory *factory); GtkWidget * (* create_tab_label) (TeplAbstractFactory *factory, TeplTab *tab); TeplFile * (* create_file) (TeplAbstractFactory *factory); GFile * (* create_metadata_manager_file) (TeplAbstractFactory *factory); TeplPrefsDialog * (* create_prefs_dialog) (TeplAbstractFactory *factory); /*< private >*/ gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_abstract_factory_get_type (void); G_MODULE_EXPORT void tepl_abstract_factory_set_singleton (TeplAbstractFactory *factory); G_MODULE_EXPORT TeplAbstractFactory * tepl_abstract_factory_get_singleton (void); G_MODULE_EXPORT GtkApplicationWindow * tepl_abstract_factory_create_main_window (TeplAbstractFactory *factory, GtkApplication *app); G_MODULE_EXPORT TeplTab * tepl_abstract_factory_create_tab (TeplAbstractFactory *factory); G_MODULE_EXPORT GtkWidget * tepl_abstract_factory_create_tab_label (TeplAbstractFactory *factory, TeplTab *tab); G_MODULE_EXPORT TeplFile * tepl_abstract_factory_create_file (TeplAbstractFactory *factory); G_MODULE_EXPORT GFile * tepl_abstract_factory_create_metadata_manager_file (TeplAbstractFactory *factory); G_MODULE_EXPORT TeplPrefsDialog * tepl_abstract_factory_create_prefs_dialog (TeplAbstractFactory *factory); G_GNUC_INTERNAL void _tepl_abstract_factory_unref_singleton (void); G_END_DECLS #endif /* TEPL_ABSTRACT_FACTORY_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-application-window.c000066400000000000000000000546521526404732400301120ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-application-window.h" #include #include "tepl-abstract-factory.h" #include "tepl-buffer.h" #include "tepl-signal-group.h" #include "tepl-tab-loading.h" #include "tepl-window-actions-file.h" #include "tepl-window-actions-edit.h" #include "tepl-window-actions-search.h" /** * SECTION:application-window * @Short_description: An extension of GtkApplicationWindow * @Title: TeplApplicationWindow * * #TeplApplicationWindow extends the #GtkApplicationWindow class. * * An application needs to call tepl_application_window_set_tab_group() to * benefit from the #TeplTabGroup interface implemented by this class. * * Note that #TeplApplicationWindow extends the #GtkApplicationWindow class but * without subclassing it, because several libraries might want to extend * #GtkApplicationWindow and an application needs to be able to use all those * extensions at the same time. * * # GActions # {#tepl-application-window-gactions} * * This class adds the following #GAction's to the #GtkApplicationWindow. * Corresponding #AmtkActionInfo's are available with * tepl_application_get_tepl_action_info_store(). * * ## For the File menu * * - `"win.tepl-new-file"`: creates a new #TeplTab, appends it with * tepl_tab_group_append_tab() and set it as the active tab. * - `"win.tepl-open"`: shows a #GtkFileChooser to open a new file. * - `"win.tepl-save"`: saves the current file. * - `"win.tepl-save-as"`: shows a #GtkFileChooser to save the current file to a * different location. * * ## For the Edit menu * * - `"win.tepl-undo"`: calls gtk_source_buffer_undo() on the active buffer. * - `"win.tepl-redo"`: calls gtk_source_buffer_redo() on the active buffer. * * The following actions require the %AMTK_FACTORY_IGNORE_ACCELS_FOR_APP flag, * because otherwise accelerators don't work in other text widgets than the * active view (e.g. in a #GtkEntry): * - `"win.tepl-cut"`: calls tepl_view_cut_clipboard() on the active view. * - `"win.tepl-copy"`: calls tepl_view_copy_clipboard() on the active view. * - `"win.tepl-paste"`: calls tepl_view_paste_clipboard() on the active view. * - `"win.tepl-delete"`: calls tepl_view_delete_selection() on the active view. * - `"win.tepl-select-all"`: calls tepl_view_select_all() on the active view. * - `"win.tepl-indent"`: calls gtk_source_view_indent_lines() on the selected * text of the active view. * - `"win.tepl-unindent"`: calls gtk_source_view_unindent_lines() on the * selected text of the active view. * * See the tepl_menu_shell_append_edit_actions() convenience function. * * ## For the Search menu * * - `"win.tepl-goto-line"`: shows the #TeplGotoLineBar of all #TeplTab's * belonging to #TeplApplicationWindow. Even though each #TeplTab has a * different #TeplGotoLineBar, all #TeplGotoLineBar's of the #TeplTabGroup * have their #GtkWidget:visible state synchronized, so when one * #TeplGotoLineBar is hidden, all the other #TeplGotoLineBar's are hidden as * well. The user may think that there is only one #TeplGotoLineBar per * window, with the #TeplGotoLineBar remembering a different state (mainly the * content of the #GtkSearchEntry) for each #TeplTab. To remember the state * for each #TeplTab, the easiest is to have a different widget for each * #TeplTab, hence the current implementation. */ struct _TeplApplicationWindowPrivate { GtkApplicationWindow *gtk_window; TeplWindowActionsEdit *window_actions_edit; GtkWindowGroup *window_group; TeplTabGroup *tab_group; TeplSignalGroup *view_signal_group; TeplSignalGroup *buffer_signal_group; guint handle_title : 1; }; enum { PROP_0, PROP_APPLICATION_WINDOW, PROP_ACTIVE_TAB, PROP_ACTIVE_VIEW, PROP_ACTIVE_BUFFER, PROP_HANDLE_TITLE, }; #define TEPL_APPLICATION_WINDOW_KEY "tepl-application-window-key" static void tepl_tab_group_interface_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (TeplApplicationWindow, tepl_application_window, G_TYPE_OBJECT, G_ADD_PRIVATE (TeplApplicationWindow) G_IMPLEMENT_INTERFACE (TEPL_TYPE_TAB_GROUP, tepl_tab_group_interface_init)) static void update_title (TeplApplicationWindow *tepl_window) { TeplView *active_view; if (!tepl_window->priv->handle_title) { return; } active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (active_view == NULL) { gtk_window_set_title (GTK_WINDOW (tepl_window->priv->gtk_window), g_get_application_name ()); } else { TeplBuffer *active_buffer; gchar *buffer_title; gboolean read_only; gchar *read_only_str = NULL; gchar *window_title; active_buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); /* It is fine to call gtk_window_set_title() with a too long * string, but in that case the application name is not visible. * * Possible improvement: pass an additional int parameter to * tepl_buffer_get_full_title() to middle-truncate its longest * component (either the filename or the directory). */ buffer_title = tepl_buffer_get_full_title (active_buffer); read_only = !gtk_text_view_get_editable (GTK_TEXT_VIEW (active_view)); if (read_only) { read_only_str = g_strdup_printf (" [%s]", _("Read-Only")); } window_title = g_strdup_printf ("%s%s - %s", buffer_title, read_only ? read_only_str : "", g_get_application_name ()); gtk_window_set_title (GTK_WINDOW (tepl_window->priv->gtk_window), window_title); g_free (buffer_title); g_free (read_only_str); g_free (window_title); } } static void tepl_application_window_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (object); TeplTabGroup *tab_group = TEPL_TAB_GROUP (object); switch (prop_id) { case PROP_APPLICATION_WINDOW: g_value_set_object (value, tepl_application_window_get_application_window (tepl_window)); break; case PROP_ACTIVE_TAB: g_value_set_object (value, tepl_tab_group_get_active_tab (tab_group)); break; case PROP_ACTIVE_VIEW: g_value_set_object (value, tepl_tab_group_get_active_view (tab_group)); break; case PROP_ACTIVE_BUFFER: g_value_set_object (value, tepl_tab_group_get_active_buffer (tab_group)); break; case PROP_HANDLE_TITLE: g_value_set_boolean (value, tepl_application_window_get_handle_title (tepl_window)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_application_window_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (object); TeplTabGroup *tab_group = TEPL_TAB_GROUP (object); switch (prop_id) { case PROP_APPLICATION_WINDOW: g_assert (tepl_window->priv->gtk_window == NULL); tepl_window->priv->gtk_window = g_value_get_object (value); break; case PROP_ACTIVE_TAB: tepl_tab_group_set_active_tab (tab_group, g_value_get_object (value)); break; case PROP_HANDLE_TITLE: tepl_application_window_set_handle_title (tepl_window, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_application_window_constructed (GObject *object) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (object); if (G_OBJECT_CLASS (tepl_application_window_parent_class)->constructed != NULL) { G_OBJECT_CLASS (tepl_application_window_parent_class)->constructed (object); } _tepl_window_actions_file_add_actions (tepl_window); _tepl_window_actions_search_add_actions (tepl_window); g_assert (tepl_window->priv->window_actions_edit == NULL); tepl_window->priv->window_actions_edit = _tepl_window_actions_edit_new (tepl_window); } static void tepl_application_window_dispose (GObject *object) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (object); tepl_window->priv->gtk_window = NULL; _tepl_window_actions_edit_clear (&tepl_window->priv->window_actions_edit); g_clear_object (&tepl_window->priv->window_group); g_clear_object (&tepl_window->priv->tab_group); tepl_signal_group_clear (&tepl_window->priv->view_signal_group); tepl_signal_group_clear (&tepl_window->priv->buffer_signal_group); G_OBJECT_CLASS (tepl_application_window_parent_class)->dispose (object); } static void tepl_application_window_class_init (TeplApplicationWindowClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_application_window_get_property; object_class->set_property = tepl_application_window_set_property; object_class->constructed = tepl_application_window_constructed; object_class->dispose = tepl_application_window_dispose; /** * TeplApplicationWindow:application-window: * * The #GtkApplicationWindow. * * Since: 2.0 */ g_object_class_install_property (object_class, PROP_APPLICATION_WINDOW, g_param_spec_object ("application-window", "GtkApplicationWindow", "", GTK_TYPE_APPLICATION_WINDOW, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_override_property (object_class, PROP_ACTIVE_TAB, "active-tab"); g_object_class_override_property (object_class, PROP_ACTIVE_VIEW, "active-view"); g_object_class_override_property (object_class, PROP_ACTIVE_BUFFER, "active-buffer"); /** * TeplApplicationWindow:handle-title: * * Whether to handle the #GtkWindow:title. The title is probably not * appropriate if a #GtkHeaderBar is used, the title is meant to be used * only for applications with a traditional UI. * * If %TRUE, the title will contain: * - the #TeplBuffer:tepl-full-title of the active buffer. * - if the active view is not #GtkTextView:editable, the * `"[Read-Only]"` string. * - the application name as returned by g_get_application_name(). * * If the active view is %NULL, the title contains only the application * name. * * Since: 4.0 */ g_object_class_install_property (object_class, PROP_HANDLE_TITLE, g_param_spec_boolean ("handle-title", "handle-title", "", FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); } static GList * tepl_application_window_get_tabs (TeplTabGroup *tab_group) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (tab_group); if (tepl_window->priv->tab_group == NULL) { return NULL; } return tepl_tab_group_get_tabs (tepl_window->priv->tab_group); } static TeplTab * tepl_application_window_get_active_tab (TeplTabGroup *tab_group) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (tab_group); if (tepl_window->priv->tab_group == NULL) { return NULL; } return tepl_tab_group_get_active_tab (tepl_window->priv->tab_group); } static void tepl_application_window_set_active_tab (TeplTabGroup *tab_group, TeplTab *tab) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (tab_group); if (tepl_window->priv->tab_group != NULL) { tepl_tab_group_set_active_tab (tepl_window->priv->tab_group, tab); } } static void tepl_application_window_append_tab_vfunc (TeplTabGroup *tab_group, TeplTab *tab) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (tab_group); if (tepl_window->priv->tab_group != NULL) { tepl_tab_group_append_tab (tepl_window->priv->tab_group, tab, FALSE); } } static void tepl_tab_group_interface_init (gpointer g_iface, gpointer iface_data) { TeplTabGroupInterface *interface = g_iface; interface->get_tabs = tepl_application_window_get_tabs; interface->get_active_tab = tepl_application_window_get_active_tab; interface->set_active_tab = tepl_application_window_set_active_tab; interface->append_tab_vfunc = tepl_application_window_append_tab_vfunc; } static void tepl_application_window_init (TeplApplicationWindow *tepl_window) { tepl_window->priv = tepl_application_window_get_instance_private (tepl_window); } /** * tepl_application_window_get_from_gtk_application_window: * @gtk_window: a #GtkApplicationWindow. * * Returns the #TeplApplicationWindow of @gtk_window. The returned object is * guaranteed to be the same for the lifetime of @gtk_window. * * Returns: (transfer none): the #TeplApplicationWindow of @gtk_window. * Since: 2.0 */ TeplApplicationWindow * tepl_application_window_get_from_gtk_application_window (GtkApplicationWindow *gtk_window) { TeplApplicationWindow *tepl_window; g_return_val_if_fail (GTK_IS_APPLICATION_WINDOW (gtk_window), NULL); tepl_window = g_object_get_data (G_OBJECT (gtk_window), TEPL_APPLICATION_WINDOW_KEY); if (tepl_window == NULL) { tepl_window = g_object_new (TEPL_TYPE_APPLICATION_WINDOW, "application-window", gtk_window, NULL); g_object_set_data_full (G_OBJECT (gtk_window), TEPL_APPLICATION_WINDOW_KEY, tepl_window, g_object_unref); } g_return_val_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window), NULL); return tepl_window; } /** * tepl_application_window_get_application_window: * @tepl_window: a #TeplApplicationWindow. * * Returns: (transfer none): the #GtkApplicationWindow of @tepl_window. * Since: 2.0 */ GtkApplicationWindow * tepl_application_window_get_application_window (TeplApplicationWindow *tepl_window) { g_return_val_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window), NULL); return tepl_window->priv->gtk_window; } static void active_tab_changed (TeplApplicationWindow *tepl_window) { update_title (tepl_window); } static void active_view_editable_notify_cb (GtkTextView *active_view, GParamSpec *pspec, TeplApplicationWindow *tepl_window) { update_title (tepl_window); } static void active_view_changed (TeplApplicationWindow *tepl_window) { TeplView *active_view; tepl_signal_group_clear (&tepl_window->priv->view_signal_group); active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (active_view == NULL) { return; } tepl_window->priv->view_signal_group = tepl_signal_group_new (G_OBJECT (active_view)); tepl_signal_group_add (tepl_window->priv->view_signal_group, g_signal_connect (active_view, "notify::editable", G_CALLBACK (active_view_editable_notify_cb), tepl_window)); } static void active_buffer_full_title_notify_cb (TeplBuffer *buffer, GParamSpec *pspec, TeplApplicationWindow *tepl_window) { update_title (tepl_window); } static void active_buffer_changed (TeplApplicationWindow *tepl_window) { TeplBuffer *active_buffer; tepl_signal_group_clear (&tepl_window->priv->buffer_signal_group); active_buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); if (active_buffer == NULL) { goto end; } tepl_window->priv->buffer_signal_group = tepl_signal_group_new (G_OBJECT (active_buffer)); tepl_signal_group_add (tepl_window->priv->buffer_signal_group, g_signal_connect (active_buffer, "notify::tepl-full-title", G_CALLBACK (active_buffer_full_title_notify_cb), tepl_window)); end: update_title (tepl_window); } static void active_tab_notify_cb (TeplTabGroup *tab_group, GParamSpec *pspec, TeplApplicationWindow *tepl_window) { active_tab_changed (tepl_window); g_object_notify (G_OBJECT (tepl_window), "active-tab"); } static void active_view_notify_cb (TeplTabGroup *tab_group, GParamSpec *pspec, TeplApplicationWindow *tepl_window) { active_view_changed (tepl_window); g_object_notify (G_OBJECT (tepl_window), "active-view"); } static void active_buffer_notify_cb (TeplTabGroup *tab_group, GParamSpec *pspec, TeplApplicationWindow *tepl_window) { active_buffer_changed (tepl_window); g_object_notify (G_OBJECT (tepl_window), "active-buffer"); } /** * tepl_application_window_set_tab_group: * @tepl_window: a #TeplApplicationWindow. * @tab_group: a #TeplTabGroup. * * Sets the #TeplTabGroup of @tepl_window. This function can be called only * once, it is not possible to change the #TeplTabGroup afterwards (this * restriction may be lifted in the future if there is a compelling use-case). * * #TeplApplicationWindow implements the #TeplTabGroup interface by delegating * the requests to @tab_group. * * Since: 3.0 */ void tepl_application_window_set_tab_group (TeplApplicationWindow *tepl_window, TeplTabGroup *tab_group) { TeplTab *active_tab; g_return_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window)); g_return_if_fail (TEPL_IS_TAB_GROUP (tab_group)); if (tepl_window->priv->tab_group != NULL) { g_warning ("%s(): the TeplTabGroup has already been set, it can be set only once.", G_STRFUNC); return; } tepl_window->priv->tab_group = g_object_ref_sink (tab_group); g_signal_connect_object (tab_group, "notify::active-tab", G_CALLBACK (active_tab_notify_cb), tepl_window, 0); g_signal_connect_object (tab_group, "notify::active-view", G_CALLBACK (active_view_notify_cb), tepl_window, 0); g_signal_connect_object (tab_group, "notify::active-buffer", G_CALLBACK (active_buffer_notify_cb), tepl_window, 0); active_tab = tepl_tab_group_get_active_tab (tab_group); if (active_tab != NULL) { active_tab_changed (tepl_window); g_object_notify (G_OBJECT (tepl_window), "active-tab"); active_view_changed (tepl_window); g_object_notify (G_OBJECT (tepl_window), "active-view"); active_buffer_changed (tepl_window); g_object_notify (G_OBJECT (tepl_window), "active-buffer"); } } /** * tepl_application_window_is_main_window: * @gtk_window: a #GtkApplicationWindow. * * Returns %TRUE if and only if @gtk_window has an associated #TeplTabGroup * (i.e. when tepl_application_window_set_tab_group() has been called). * * This function takes a #GtkApplicationWindow parameter to avoid creating the * #TeplApplicationWindow object if it hasn't been created. * * Returns: whether @gtk_window is considered a main application window. * Since: 4.0 */ gboolean tepl_application_window_is_main_window (GtkApplicationWindow *gtk_window) { TeplApplicationWindow *tepl_window; g_return_val_if_fail (GTK_IS_APPLICATION_WINDOW (gtk_window), FALSE); tepl_window = g_object_get_data (G_OBJECT (gtk_window), TEPL_APPLICATION_WINDOW_KEY); if (tepl_window == NULL) { return FALSE; } return tepl_window->priv->tab_group != NULL; } /** * tepl_application_window_get_window_group: * @tepl_window: a #TeplApplicationWindow. * * Gets the #GtkWindowGroup in which @tepl_window resides. * * You should call this function only on main windows, to add secondary windows * to the #GtkWindowGroup. * * Returns: (transfer none): the #GtkWindowGroup. * Since: 4.0 */ GtkWindowGroup * tepl_application_window_get_window_group (TeplApplicationWindow *tepl_window) { g_return_val_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window), NULL); /* Lazy init. * * If the GtkWindowGroup was created in constructed() instead, this can * be dangerous because the mere fact of calling * tepl_application_window_get_from_gtk_application_window() would add * the window to a different GtkWindowGroup. If for one reason or * another the TeplApplicationWindow object is created for a secondary * window, it should not cause problems. * * It is not a problem if a main window is still part of the default * window group (i.e. if this function has never been called on that * main window). For example when creating a modal dialog, this function * will be called on the corresponding main window, and it'll still be * possible to interact with the other main windows that are part of the * default window group. */ if (tepl_window->priv->window_group == NULL) { tepl_window->priv->window_group = gtk_window_group_new (); gtk_window_group_add_window (tepl_window->priv->window_group, GTK_WINDOW (tepl_window->priv->gtk_window)); } return tepl_window->priv->window_group; } /** * tepl_application_window_get_handle_title: * @tepl_window: a #TeplApplicationWindow. * * Returns: the value of the #TeplApplicationWindow:handle-title property. * Since: 4.0 */ gboolean tepl_application_window_get_handle_title (TeplApplicationWindow *tepl_window) { g_return_val_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window), FALSE); return tepl_window->priv->handle_title; } /** * tepl_application_window_set_handle_title: * @tepl_window: a #TeplApplicationWindow. * @handle_title: the new value. * * Sets the #TeplApplicationWindow:handle-title property. * * Since: 4.0 */ void tepl_application_window_set_handle_title (TeplApplicationWindow *tepl_window, gboolean handle_title) { g_return_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window)); handle_title = handle_title != FALSE; if (tepl_window->priv->handle_title != handle_title) { tepl_window->priv->handle_title = handle_title; update_title (tepl_window); g_object_notify (G_OBJECT (tepl_window), "handle-title"); } } /** * tepl_application_window_open_file: * @tepl_window: a #TeplApplicationWindow. * @location: a #GFile. * @jump_to: whether to set the tab where the file is loaded as the active tab. * * Opens a file in @tepl_window. If the active tab is untouched (see * tepl_buffer_is_untouched()), then the file is loaded in that tab. Otherwise a * new tab is created. * * This function is asynchronous, the file loading is done with the * tepl_tab_load_file() function. There is no way to know when the file loading * is finished. * * Since: 4.0 */ void tepl_application_window_open_file (TeplApplicationWindow *tepl_window, GFile *location, gboolean jump_to) { TeplTab *tab; TeplBuffer *buffer; g_return_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window)); g_return_if_fail (G_IS_FILE (location)); tab = tepl_tab_group_get_active_tab (TEPL_TAB_GROUP (tepl_window)); buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); if (buffer == NULL || !tepl_buffer_is_untouched (buffer)) { TeplAbstractFactory *factory; factory = tepl_abstract_factory_get_singleton (); tab = tepl_abstract_factory_create_tab (factory); gtk_widget_show (GTK_WIDGET (tab)); tepl_tab_group_append_tab (TEPL_TAB_GROUP (tepl_window), tab, jump_to); } tepl_tab_load_file (tab, location); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-application-window.h000066400000000000000000000052401526404732400301040ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_APPLICATION_WINDOW_H #define TEPL_APPLICATION_WINDOW_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS #define TEPL_TYPE_APPLICATION_WINDOW (tepl_application_window_get_type ()) #define TEPL_APPLICATION_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_APPLICATION_WINDOW, TeplApplicationWindow)) #define TEPL_APPLICATION_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_APPLICATION_WINDOW, TeplApplicationWindowClass)) #define TEPL_IS_APPLICATION_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_APPLICATION_WINDOW)) #define TEPL_IS_APPLICATION_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_APPLICATION_WINDOW)) #define TEPL_APPLICATION_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_APPLICATION_WINDOW, TeplApplicationWindowClass)) typedef struct _TeplApplicationWindow TeplApplicationWindow; typedef struct _TeplApplicationWindowClass TeplApplicationWindowClass; typedef struct _TeplApplicationWindowPrivate TeplApplicationWindowPrivate; struct _TeplApplicationWindow { GObject parent; TeplApplicationWindowPrivate *priv; }; struct _TeplApplicationWindowClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_application_window_get_type (void); G_MODULE_EXPORT TeplApplicationWindow * tepl_application_window_get_from_gtk_application_window (GtkApplicationWindow *gtk_window); G_MODULE_EXPORT GtkApplicationWindow * tepl_application_window_get_application_window (TeplApplicationWindow *tepl_window); G_MODULE_EXPORT void tepl_application_window_set_tab_group (TeplApplicationWindow *tepl_window, TeplTabGroup *tab_group); G_MODULE_EXPORT gboolean tepl_application_window_is_main_window (GtkApplicationWindow *gtk_window); G_MODULE_EXPORT GtkWindowGroup * tepl_application_window_get_window_group (TeplApplicationWindow *tepl_window); G_MODULE_EXPORT gboolean tepl_application_window_get_handle_title (TeplApplicationWindow *tepl_window); G_MODULE_EXPORT void tepl_application_window_set_handle_title (TeplApplicationWindow *tepl_window, gboolean handle_title); G_MODULE_EXPORT void tepl_application_window_open_file (TeplApplicationWindow *tepl_window, GFile *location, gboolean jump_to); G_END_DECLS #endif /* TEPL_APPLICATION_WINDOW_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-application.c000066400000000000000000000427171526404732400266040ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-application.h" #include #include "tepl-abstract-factory.h" #include "tepl-application-window.h" #include "tepl-metadata-manager.h" /** * SECTION:application * @Short_description: An extension of GtkApplication * @Title: TeplApplication * * #TeplApplication extends the #GtkApplication class. * * For some features, the Tepl framework gets the default #GtkApplication with * g_application_get_default(), for example to call g_application_hold(), * g_application_mark_busy(), etc. Normally a GTK application has only one * #GApplication per process, so this shouldn't cause any problem. * * Note that #TeplApplication extends the #GtkApplication class but without * subclassing it, because several libraries might want to extend * #GtkApplication and an application needs to be able to use all those * extensions at the same time. * * # GActions # {#tepl-application-gactions} * * This class adds the following #GAction's to the #GtkApplication. * Corresponding #AmtkActionInfo's are available with * tepl_application_get_tepl_action_info_store(). * * ## For the File menu * * - `"app.tepl-new-window"`: creates a new main window with * tepl_abstract_factory_create_main_window(). */ struct _TeplApplicationPrivate { GtkApplication *gtk_app; AmtkActionInfoStore *app_action_info_store; AmtkActionInfoStore *tepl_action_info_store; guint handle_activate : 1; guint handle_open : 1; guint handle_metadata : 1; }; enum { PROP_0, PROP_APPLICATION, N_PROPERTIES }; #define TEPL_APPLICATION_KEY "tepl-application-key" static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplApplication, tepl_application, G_TYPE_OBJECT) static void init_tepl_action_info_store (TeplApplication *tepl_app) { const AmtkActionInfoEntry entries[] = { /* action, icon, label, accel, tooltip */ /* File menu */ // Why "file" and not "document"? "Document" is not the best // word because the action is not always to create a new // document. For example a LaTeX document can be composed of // several _files_. Or for source code we do not really create a // new "document". { "win.tepl-new-file", "document-new", N_("_New"), "n", N_("New file") }, { "app.tepl-new-window", NULL, N_("New _Window"), NULL, N_("Create a new window") }, { "win.tepl-open", "document-open", N_("_Open"), "o", N_("Open a file") }, { "win.tepl-save", "document-save", N_("_Save"), "s", N_("Save the current file") }, { "win.tepl-save-as", "document-save-as", N_("Save _As"), "s", N_("Save the current file to a different location") }, /* Edit menu */ { "win.tepl-undo", "edit-undo", N_("_Undo"), "z", N_("Undo the last action") }, { "win.tepl-redo", "edit-redo", N_("_Redo"), "z", N_("Redo the last undone action") }, { "win.tepl-cut", "edit-cut", N_("Cu_t"), "x", N_("Cut the selection") }, { "win.tepl-copy", "edit-copy", N_("_Copy"), "c", N_("Copy the selection") }, { "win.tepl-paste", "edit-paste", N_("_Paste"), "v", N_("Paste the clipboard") }, { "win.tepl-delete", "edit-delete", N_("_Delete"), NULL, N_("Delete the selected text") }, { "win.tepl-select-all", "edit-select-all", N_("Select _All"), "a", N_("Select all the text") }, { "win.tepl-indent", "format-indent-more", N_("_Indent"), "Tab", N_("Indent the selected lines") }, { "win.tepl-unindent", "format-indent-less", N_("_Unindent"), "Tab", N_("Unindent the selected lines") }, /* Search menu */ { "win.tepl-goto-line", "go-jump", N_("_Go to Line…"), "l", N_("Go to a specific line") }, }; g_assert (tepl_app->priv->tepl_action_info_store == NULL); tepl_app->priv->tepl_action_info_store = amtk_action_info_store_new (); amtk_action_info_store_add_entries (tepl_app->priv->tepl_action_info_store, entries, G_N_ELEMENTS (entries), GETTEXT_PACKAGE); } static void new_window_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplication *tepl_app = TEPL_APPLICATION (user_data); TeplAbstractFactory *factory; GtkApplicationWindow *main_window; factory = tepl_abstract_factory_get_singleton (); main_window = tepl_abstract_factory_create_main_window (factory, tepl_app->priv->gtk_app); g_return_if_fail (main_window != NULL); gtk_widget_show (GTK_WIDGET (main_window)); } static void add_actions (TeplApplication *tepl_app) { /* The actions need to be namespaced, to not conflict with the * application or other libraries. * * Do not forget to document each action in the TeplApplication class * description, and to add the corresponding AmtkActionInfoEntry in * init_tepl_action_info_store(). */ const GActionEntry entries[] = { /* File menu */ { "tepl-new-window", new_window_cb }, }; amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (tepl_app->priv->gtk_app), entries, G_N_ELEMENTS (entries), tepl_app); } static void tepl_application_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplApplication *tepl_app = TEPL_APPLICATION (object); switch (prop_id) { case PROP_APPLICATION: g_value_set_object (value, tepl_application_get_application (tepl_app)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_application_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplApplication *tepl_app = TEPL_APPLICATION (object); switch (prop_id) { case PROP_APPLICATION: g_assert (tepl_app->priv->gtk_app == NULL); tepl_app->priv->gtk_app = g_value_get_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_application_constructed (GObject *object) { TeplApplication *tepl_app = TEPL_APPLICATION (object); if (G_OBJECT_CLASS (tepl_application_parent_class)->constructed != NULL) { G_OBJECT_CLASS (tepl_application_parent_class)->constructed (object); } add_actions (tepl_app); } static void tepl_application_dispose (GObject *object) { TeplApplication *tepl_app = TEPL_APPLICATION (object); tepl_app->priv->gtk_app = NULL; g_clear_object (&tepl_app->priv->app_action_info_store); g_clear_object (&tepl_app->priv->tepl_action_info_store); G_OBJECT_CLASS (tepl_application_parent_class)->dispose (object); } static void tepl_application_class_init (TeplApplicationClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_application_get_property; object_class->set_property = tepl_application_set_property; object_class->constructed = tepl_application_constructed; object_class->dispose = tepl_application_dispose; /** * TeplApplication:application: * * The #GtkApplication. * * Since: 2.0 */ properties[PROP_APPLICATION] = g_param_spec_object ("application", "GtkApplication", "", GTK_TYPE_APPLICATION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_application_init (TeplApplication *tepl_app) { tepl_app->priv = tepl_application_get_instance_private (tepl_app); tepl_app->priv->app_action_info_store = amtk_action_info_store_new (); init_tepl_action_info_store (tepl_app); } /** * tepl_application_get_from_gtk_application: * @gtk_app: a #GtkApplication. * * Returns the #TeplApplication of @gtk_app. The returned object is guaranteed * to be the same for the lifetime of @gtk_app. * * Returns: (transfer none): the #TeplApplication of @gtk_app. * Since: 2.0 */ TeplApplication * tepl_application_get_from_gtk_application (GtkApplication *gtk_app) { TeplApplication *tepl_app; g_return_val_if_fail (GTK_IS_APPLICATION (gtk_app), NULL); tepl_app = g_object_get_data (G_OBJECT (gtk_app), TEPL_APPLICATION_KEY); if (tepl_app == NULL) { tepl_app = g_object_new (TEPL_TYPE_APPLICATION, "application", gtk_app, NULL); g_object_set_data_full (G_OBJECT (gtk_app), TEPL_APPLICATION_KEY, tepl_app, g_object_unref); } g_return_val_if_fail (TEPL_IS_APPLICATION (tepl_app), NULL); return tepl_app; } /** * tepl_application_get_default: * * Convenience function that calls g_application_get_default() followed by * tepl_application_get_from_gtk_application(). The object returned by * g_application_get_default() must be a #GtkApplication. * * Returns: (transfer none): the default #TeplApplication. * Since: 2.0 */ TeplApplication * tepl_application_get_default (void) { GApplication *g_app; g_app = g_application_get_default (); g_return_val_if_fail (GTK_IS_APPLICATION (g_app), NULL); return tepl_application_get_from_gtk_application (GTK_APPLICATION (g_app)); } /** * tepl_application_get_application: * @tepl_app: a #TeplApplication. * * Returns: (transfer none): the #GtkApplication of @tepl_app. * Since: 2.0 */ GtkApplication * tepl_application_get_application (TeplApplication *tepl_app) { g_return_val_if_fail (TEPL_IS_APPLICATION (tepl_app), NULL); return tepl_app->priv->gtk_app; } /** * tepl_application_get_app_action_info_store: * @tepl_app: a #TeplApplication. * * Returns an initially empty #AmtkActionInfoStore reserved for the * application-specific actions. Libraries should not add #AmtkActionInfo's to * this store. Libraries should provide their own store if they want to share * #AmtkActionInfo's. * * Returns: (transfer none): the #AmtkActionInfoStore reserved for the * application. * Since: 2.0 */ AmtkActionInfoStore * tepl_application_get_app_action_info_store (TeplApplication *tepl_app) { g_return_val_if_fail (TEPL_IS_APPLICATION (tepl_app), NULL); return tepl_app->priv->app_action_info_store; } /** * tepl_application_get_tepl_action_info_store: * @tepl_app: a #TeplApplication. * * The returned #AmtkActionInfoStore contains #AmtkActionInfo's for all the * #GAction's listed in the [class description of * TeplApplicationWindow][tepl-application-window-gactions] and the [class * description of TeplApplication][tepl-application-gactions]. * * Returns: (transfer none): the #AmtkActionInfoStore of the Tepl library. * Since: 3.0 */ AmtkActionInfoStore * tepl_application_get_tepl_action_info_store (TeplApplication *tepl_app) { g_return_val_if_fail (TEPL_IS_APPLICATION (tepl_app), NULL); return tepl_app->priv->tepl_action_info_store; } /** * tepl_application_get_active_main_window: * @tepl_app: a #TeplApplication. * * Like gtk_application_get_active_window(), but returns the main window in the * sense of tepl_application_window_is_main_window(). * * Returns: (transfer none) (nullable): the active main #GtkApplicationWindow, * or %NULL. * Since: 4.0 */ GtkApplicationWindow * tepl_application_get_active_main_window (TeplApplication *tepl_app) { GList *windows; GList *l; g_return_val_if_fail (TEPL_IS_APPLICATION (tepl_app), NULL); windows = gtk_application_get_windows (tepl_app->priv->gtk_app); for (l = windows; l != NULL; l = l->next) { GtkWindow *window = l->data; if (GTK_IS_APPLICATION_WINDOW (window) && tepl_application_window_is_main_window (GTK_APPLICATION_WINDOW (window))) { return GTK_APPLICATION_WINDOW (window); } } return NULL; } /** * tepl_application_open_simple: * @tepl_app: a #TeplApplication. * @file: a #GFile. * * Calls g_application_open() with a single file and an empty hint. * * Since: 2.0 */ void tepl_application_open_simple (TeplApplication *tepl_app, GFile *file) { GFile *files[1]; g_return_if_fail (TEPL_IS_APPLICATION (tepl_app)); g_return_if_fail (G_IS_FILE (file)); files[0] = file; g_application_open (G_APPLICATION (tepl_app->priv->gtk_app), files, 1, ""); } static void activate_cb (GApplication *g_app, TeplApplication *tepl_app) { GtkApplicationWindow *main_window; g_application_hold (g_app); main_window = tepl_application_get_active_main_window (tepl_app); if (main_window == NULL) { TeplAbstractFactory *factory; factory = tepl_abstract_factory_get_singleton (); main_window = tepl_abstract_factory_create_main_window (factory, tepl_app->priv->gtk_app); gtk_widget_show (GTK_WIDGET (main_window)); } else { GtkWindow *active_window; active_window = gtk_application_get_active_window (tepl_app->priv->gtk_app); gtk_window_present (active_window); } g_application_release (g_app); } /** * tepl_application_handle_activate: * @tepl_app: a #TeplApplication. * * Connects a generic function handler for the #GApplication::activate signal. * * If no main windows exist, it creates one with * tepl_abstract_factory_create_main_window(). If a main window already exists, * it calls gtk_window_present() on the most recently focused window of the * application. * * Since: 4.0 */ void tepl_application_handle_activate (TeplApplication *tepl_app) { g_return_if_fail (TEPL_IS_APPLICATION (tepl_app)); if (!tepl_app->priv->handle_activate) { g_signal_connect_object (tepl_app->priv->gtk_app, "activate", G_CALLBACK (activate_cb), tepl_app, 0); tepl_app->priv->handle_activate = TRUE; } } static void open_cb (GApplication *g_app, GFile **files, gint n_files, const gchar *hint, TeplApplication *tepl_app) { GtkApplicationWindow *main_window; TeplApplicationWindow *tepl_window; gint file_num; if (n_files < 1) { return; } g_application_hold (g_app); main_window = tepl_application_get_active_main_window (tepl_app); if (main_window == NULL) { TeplAbstractFactory *factory; factory = tepl_abstract_factory_get_singleton (); main_window = tepl_abstract_factory_create_main_window (factory, tepl_app->priv->gtk_app); if (main_window == NULL) { g_warn_if_reached (); goto out; } gtk_widget_show (GTK_WIDGET (main_window)); } tepl_window = tepl_application_window_get_from_gtk_application_window (main_window); /* It's OK to open all the files in parallel, there is anyway the GIO * thread pool. */ for (file_num = 0; file_num < n_files; file_num++) { GFile *cur_file = files[file_num]; gboolean jump_to = file_num == 0; tepl_application_window_open_file (tepl_window, cur_file, jump_to); } out: g_application_release (g_app); } /** * tepl_application_handle_open: * @tepl_app: a #TeplApplication. * * Connects a generic function handler for the #GApplication::open signal. * * It calls tepl_application_window_open_file() for each #GFile to open, on the * active main window as returned by tepl_application_get_active_main_window(). * If the active main window is %NULL, it creates one with * tepl_abstract_factory_create_main_window(). * * Since: 4.0 */ void tepl_application_handle_open (TeplApplication *tepl_app) { g_return_if_fail (TEPL_IS_APPLICATION (tepl_app)); if (!tepl_app->priv->handle_open) { g_signal_connect_object (tepl_app->priv->gtk_app, "open", G_CALLBACK (open_cb), tepl_app, 0); tepl_app->priv->handle_open = TRUE; } } static void handle_metadata__startup_cb (GtkApplication *gtk_app, TeplApplication *tepl_app) { TeplAbstractFactory *factory = tepl_abstract_factory_get_singleton (); TeplMetadataManager *manager = tepl_metadata_manager_get_singleton (); GFile *file; GError *error = NULL; file = tepl_abstract_factory_create_metadata_manager_file (factory); if (file == NULL) { return; } tepl_metadata_manager_load_from_disk (manager, file, &error); if (error != NULL) { g_warning ("Failed to load metadata: %s", error->message); g_clear_error (&error); } g_object_unref (file); } static void handle_metadata__shutdown_after_cb (GtkApplication *gtk_app, TeplApplication *tepl_app) { TeplAbstractFactory *factory = tepl_abstract_factory_get_singleton (); TeplMetadataManager *manager = tepl_metadata_manager_get_singleton (); GFile *file; GError *error = NULL; file = tepl_abstract_factory_create_metadata_manager_file (factory); if (file == NULL) { return; } tepl_metadata_manager_save_to_disk (manager, file, TRUE, &error); if (error != NULL) { g_warning ("Failed to save metadata: %s", error->message); g_clear_error (&error); } g_object_unref (file); } /** * tepl_application_handle_metadata: * @tepl_app: a #TeplApplication. * * This function: * - Connects to the #GApplication::startup signal to call * tepl_metadata_manager_load_from_disk(). * - Connects to the #GApplication::shutdown signal to call * tepl_metadata_manager_save_to_disk() with @trim set to %TRUE. * * It gets the #GFile by calling * tepl_abstract_factory_create_metadata_manager_file(). * * Since: 5.0 */ void tepl_application_handle_metadata (TeplApplication *tepl_app) { g_return_if_fail (TEPL_IS_APPLICATION (tepl_app)); if (!tepl_app->priv->handle_metadata) { g_signal_connect_object (tepl_app->priv->gtk_app, "startup", G_CALLBACK (handle_metadata__startup_cb), tepl_app, 0); /* Connect with G_CONNECT_AFTER, so that GTK is properly * shutdown. Saving metadata should be done last. */ g_signal_connect_object (tepl_app->priv->gtk_app, "shutdown", G_CALLBACK (handle_metadata__shutdown_after_cb), tepl_app, G_CONNECT_AFTER); tepl_app->priv->handle_metadata = TRUE; } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-application.h000066400000000000000000000046111526404732400266000ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_APPLICATION_H #define TEPL_APPLICATION_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS #define TEPL_TYPE_APPLICATION (tepl_application_get_type ()) #define TEPL_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_APPLICATION, TeplApplication)) #define TEPL_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_APPLICATION, TeplApplicationClass)) #define TEPL_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_APPLICATION)) #define TEPL_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_APPLICATION)) #define TEPL_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_APPLICATION, TeplApplicationClass)) typedef struct _TeplApplication TeplApplication; typedef struct _TeplApplicationClass TeplApplicationClass; typedef struct _TeplApplicationPrivate TeplApplicationPrivate; struct _TeplApplication { GObject parent; TeplApplicationPrivate *priv; }; struct _TeplApplicationClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_application_get_type (void); G_MODULE_EXPORT TeplApplication * tepl_application_get_from_gtk_application (GtkApplication *gtk_app); G_MODULE_EXPORT TeplApplication * tepl_application_get_default (void); G_MODULE_EXPORT GtkApplication * tepl_application_get_application (TeplApplication *tepl_app); G_MODULE_EXPORT AmtkActionInfoStore * tepl_application_get_app_action_info_store (TeplApplication *tepl_app); G_MODULE_EXPORT AmtkActionInfoStore * tepl_application_get_tepl_action_info_store (TeplApplication *tepl_app); G_MODULE_EXPORT GtkApplicationWindow * tepl_application_get_active_main_window (TeplApplication *tepl_app); G_MODULE_EXPORT void tepl_application_open_simple (TeplApplication *tepl_app, GFile *file); G_MODULE_EXPORT void tepl_application_handle_activate (TeplApplication *tepl_app); G_MODULE_EXPORT void tepl_application_handle_open (TeplApplication *tepl_app); G_MODULE_EXPORT void tepl_application_handle_metadata (TeplApplication *tepl_app); G_END_DECLS #endif /* TEPL_APPLICATION_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-buffer.c000066400000000000000000000453261526404732400255510ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-buffer.h" #include "tepl-abstract-factory.h" #include "tepl-metadata-manager.h" #include "tepl-settings.h" #include "tepl-utils.h" /** * SECTION:buffer * @Short_description: Subclass of #GtkSourceBuffer * @Title: TeplBuffer * * #TeplBuffer is a subclass of #GtkSourceBuffer, to add more features useful * for a text editor. * * It also adds an association to a #TeplFile that can be retrieved with * tepl_buffer_get_file(). The association cannot change. The same for * #TeplMetadata with tepl_buffer_get_metadata(). * * The properties and signals have the tepl namespace, to avoid potential * conflicts in the future if the property or signal is moved to * #GtkSourceBuffer. */ typedef struct _TeplBufferPrivate TeplBufferPrivate; struct _TeplBufferPrivate { TeplFile *file; TeplMetadata *metadata; GtkTextTag *invalid_char_tag; guint n_nested_user_actions; guint idle_cursor_moved_id; }; enum { PROP_0, PROP_TEPL_SHORT_TITLE, PROP_TEPL_FULL_TITLE, N_PROPERTIES }; enum { SIGNAL_TEPL_CURSOR_MOVED, N_SIGNALS }; static GParamSpec *properties[N_PROPERTIES]; static guint signals[N_SIGNALS]; G_DEFINE_TYPE_WITH_PRIVATE (TeplBuffer, tepl_buffer, GTK_SOURCE_TYPE_BUFFER) static void update_invalid_char_tag_style (TeplBuffer *buffer) { TeplBufferPrivate *priv; GtkSourceStyleScheme *style_scheme; GtkSourceStyle *style = NULL; priv = tepl_buffer_get_instance_private (buffer); if (priv->invalid_char_tag == NULL) { return; } style_scheme = gtk_source_buffer_get_style_scheme (GTK_SOURCE_BUFFER (buffer)); if (style_scheme != NULL) { style = gtk_source_style_scheme_get_style (style_scheme, "def:error"); } gtk_source_style_apply (style, priv->invalid_char_tag); } static void tepl_buffer_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplBuffer *buffer = TEPL_BUFFER (object); switch (prop_id) { case PROP_TEPL_SHORT_TITLE: g_value_take_string (value, tepl_buffer_get_short_title (buffer)); break; case PROP_TEPL_FULL_TITLE: g_value_take_string (value, tepl_buffer_get_full_title (buffer)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_buffer_dispose (GObject *object) { TeplBufferPrivate *priv = tepl_buffer_get_instance_private (TEPL_BUFFER (object)); g_clear_object (&priv->file); g_clear_object (&priv->metadata); if (priv->idle_cursor_moved_id != 0) { g_source_remove (priv->idle_cursor_moved_id); priv->idle_cursor_moved_id = 0; } G_OBJECT_CLASS (tepl_buffer_parent_class)->dispose (object); } static gboolean idle_cursor_moved_cb (gpointer user_data) { TeplBuffer *buffer = TEPL_BUFFER (user_data); TeplBufferPrivate *priv = tepl_buffer_get_instance_private (buffer); g_signal_emit (buffer, signals[SIGNAL_TEPL_CURSOR_MOVED], 0); priv->idle_cursor_moved_id = 0; return G_SOURCE_REMOVE; } static void install_idle_cursor_moved (TeplBuffer *buffer) { TeplBufferPrivate *priv = tepl_buffer_get_instance_private (buffer); if (priv->idle_cursor_moved_id == 0) { /* High idle priority, because after loading a big file, the * GtkTextView works in the background to compute the whole size * etc. HIGH_IDLE permits to send the signal as soon as the * content is fully loaded in the GtkTextBuffer, even if * GtkTextView has not finished. */ priv->idle_cursor_moved_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE, idle_cursor_moved_cb, buffer, NULL); } } static void tepl_buffer_begin_user_action (GtkTextBuffer *buffer) { TeplBufferPrivate *priv = tepl_buffer_get_instance_private (TEPL_BUFFER (buffer)); priv->n_nested_user_actions++; if (GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->begin_user_action != NULL) { GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->begin_user_action (buffer); } } static void tepl_buffer_end_user_action (GtkTextBuffer *buffer) { TeplBufferPrivate *priv = tepl_buffer_get_instance_private (TEPL_BUFFER (buffer)); if (GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->end_user_action != NULL) { GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->end_user_action (buffer); } g_return_if_fail (priv->n_nested_user_actions > 0); priv->n_nested_user_actions--; if (priv->n_nested_user_actions == 0) { install_idle_cursor_moved (TEPL_BUFFER (buffer)); } } static void tepl_buffer_mark_set (GtkTextBuffer *buffer, const GtkTextIter *location, GtkTextMark *mark) { TeplBufferPrivate *priv = tepl_buffer_get_instance_private (TEPL_BUFFER (buffer)); if (GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->mark_set != NULL) { GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->mark_set (buffer, location, mark); } if (priv->n_nested_user_actions == 0 && mark == gtk_text_buffer_get_insert (buffer)) { install_idle_cursor_moved (TEPL_BUFFER (buffer)); } } static void tepl_buffer_changed (GtkTextBuffer *buffer) { TeplBufferPrivate *priv = tepl_buffer_get_instance_private (TEPL_BUFFER (buffer)); if (GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->changed != NULL) { GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->changed (buffer); } if (priv->n_nested_user_actions == 0) { install_idle_cursor_moved (TEPL_BUFFER (buffer)); } } static void tepl_buffer_modified_changed (GtkTextBuffer *buffer) { if (GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->modified_changed != NULL) { GTK_TEXT_BUFFER_CLASS (tepl_buffer_parent_class)->modified_changed (buffer); } g_object_notify_by_pspec (G_OBJECT (buffer), properties[PROP_TEPL_SHORT_TITLE]); g_object_notify_by_pspec (G_OBJECT (buffer), properties[PROP_TEPL_FULL_TITLE]); } static void tepl_buffer_class_init (TeplBufferClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkTextBufferClass *text_buffer_class = GTK_TEXT_BUFFER_CLASS (klass); object_class->get_property = tepl_buffer_get_property; object_class->dispose = tepl_buffer_dispose; text_buffer_class->begin_user_action = tepl_buffer_begin_user_action; text_buffer_class->end_user_action = tepl_buffer_end_user_action; text_buffer_class->mark_set = tepl_buffer_mark_set; text_buffer_class->changed = tepl_buffer_changed; text_buffer_class->modified_changed = tepl_buffer_modified_changed; /** * TeplBuffer:tepl-short-title: * * The short title. See tepl_buffer_get_short_title(). * * Since: 3.0 */ properties[PROP_TEPL_SHORT_TITLE] = g_param_spec_string ("tepl-short-title", "tepl-short-title", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** * TeplBuffer:tepl-full-title: * * The full title. See tepl_buffer_get_full_title(). * * Since: 3.0 */ properties[PROP_TEPL_FULL_TITLE] = g_param_spec_string ("tepl-full-title", "tepl-full-title", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); /** * TeplBuffer::tepl-cursor-moved: * @buffer: the #TeplBuffer emitting the signal. * * The ::tepl-cursor-moved signal is emitted when the insert mark is * moved explicitely or when the buffer changes (insert/delete). * * A typical use-case for this signal is to update the cursor position * in a statusbar. * * Since: 2.0 */ signals[SIGNAL_TEPL_CURSOR_MOVED] = g_signal_new ("tepl-cursor-moved", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (TeplBufferClass, tepl_cursor_moved), NULL, NULL, NULL, G_TYPE_NONE, 0); } static void file_short_name_notify_cb (TeplFile *file, GParamSpec *pspec, TeplBuffer *buffer) { g_object_notify_by_pspec (G_OBJECT (buffer), properties[PROP_TEPL_SHORT_TITLE]); g_object_notify_by_pspec (G_OBJECT (buffer), properties[PROP_TEPL_FULL_TITLE]); } static void style_scheme_notify_cb (GtkSourceBuffer *buffer, GParamSpec *pspec, gpointer user_data) { update_invalid_char_tag_style (TEPL_BUFFER (buffer)); } static void tepl_buffer_init (TeplBuffer *buffer) { TeplBufferPrivate *priv; TeplAbstractFactory *factory; priv = tepl_buffer_get_instance_private (buffer); factory = tepl_abstract_factory_get_singleton (); priv->file = tepl_abstract_factory_create_file (factory); priv->metadata = tepl_metadata_new (); g_signal_connect_object (priv->file, "notify::short-name", G_CALLBACK (file_short_name_notify_cb), buffer, 0); g_signal_connect (buffer, "notify::style-scheme", G_CALLBACK (style_scheme_notify_cb), NULL); } /** * tepl_buffer_new: * * Returns: a new #TeplBuffer. * Since: 1.0 */ TeplBuffer * tepl_buffer_new (void) { return g_object_new (TEPL_TYPE_BUFFER, NULL); } /** * tepl_buffer_get_file: * @buffer: a #TeplBuffer. * * Returns the #TeplFile of @buffer. The returned object is guaranteed to be the * same for the lifetime of @buffer. * * #TeplBuffer creates the #TeplFile with tepl_abstract_factory_create_file(). * * Returns: (transfer none): the associated #TeplFile. * Since: 1.0 */ TeplFile * tepl_buffer_get_file (TeplBuffer *buffer) { TeplBufferPrivate *priv; g_return_val_if_fail (TEPL_IS_BUFFER (buffer), NULL); priv = tepl_buffer_get_instance_private (buffer); return priv->file; } /** * tepl_buffer_get_metadata: * @buffer: a #TeplBuffer. * * Returns the #TeplMetadata of @buffer. The returned object is guaranteed to be * the same for the lifetime of @buffer. * * Returns: (transfer none): the associated #TeplMetadata. * Since: 5.0 */ TeplMetadata * tepl_buffer_get_metadata (TeplBuffer *buffer) { TeplBufferPrivate *priv; g_return_val_if_fail (TEPL_IS_BUFFER (buffer), NULL); priv = tepl_buffer_get_instance_private (buffer); return priv->metadata; } /** * tepl_buffer_load_metadata_from_metadata_manager: * @buffer: a #TeplBuffer. * * Calls tepl_metadata_manager_copy_from() for #TeplFile:location (if not %NULL) * to the associated #TeplMetadata of @buffer. * * Since: 5.0 */ void tepl_buffer_load_metadata_from_metadata_manager (TeplBuffer *buffer) { TeplBufferPrivate *priv; GFile *location; g_return_if_fail (TEPL_IS_BUFFER (buffer)); priv = tepl_buffer_get_instance_private (buffer); location = tepl_file_get_location (priv->file); if (location != NULL) { TeplMetadataManager *manager; manager = tepl_metadata_manager_get_singleton (); tepl_metadata_manager_copy_from (manager, location, priv->metadata); } } /** * tepl_buffer_save_metadata_into_metadata_manager: * @buffer: a #TeplBuffer. * * Calls tepl_metadata_manager_merge_into() for #TeplFile:location (if not * %NULL) from the associated #TeplMetadata of @buffer. * * Since: 5.0 */ void tepl_buffer_save_metadata_into_metadata_manager (TeplBuffer *buffer) { TeplBufferPrivate *priv; GFile *location; g_return_if_fail (TEPL_IS_BUFFER (buffer)); priv = tepl_buffer_get_instance_private (buffer); location = tepl_file_get_location (priv->file); if (location != NULL) { TeplMetadataManager *manager; manager = tepl_metadata_manager_get_singleton (); tepl_metadata_manager_merge_into (manager, location, priv->metadata); } } /** * tepl_buffer_is_untouched: * @buffer: a #TeplBuffer. * * Returns whether @buffer is untouched. * * This function is for example useful to know if we can re-use this buffer to * load a file, instead of opening a new tab or window. * * For this function to return %TRUE, the @buffer must be empty, non-modified, * the undo/redo #GtkSourceBuffer history must be empty, and the * #TeplFile:location must be %NULL. * * Returns: %TRUE if @buffer has not been touched, %FALSE otherwise. * Since: 1.0 */ gboolean tepl_buffer_is_untouched (TeplBuffer *buffer) { TeplBufferPrivate *priv; g_return_val_if_fail (TEPL_IS_BUFFER (buffer), FALSE); priv = tepl_buffer_get_instance_private (buffer); return (gtk_text_buffer_get_char_count (GTK_TEXT_BUFFER (buffer)) == 0 && !gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (buffer)) && !gtk_source_buffer_can_undo (GTK_SOURCE_BUFFER (buffer)) && !gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (buffer)) && tepl_file_get_location (priv->file) == NULL); } /** * tepl_buffer_get_short_title: * @buffer: a #TeplBuffer. * * Returns a title suitable for a tab label. It contains (in that order): * - '*' if the buffer is modified; * - the #TeplFile:short-name. * * Returns: the @buffer short title. Free the return value with g_free() when no * longer needed. * Since: 3.0 */ gchar * tepl_buffer_get_short_title (TeplBuffer *buffer) { TeplBufferPrivate *priv; gchar *short_name; gchar *short_title; g_return_val_if_fail (TEPL_IS_BUFFER (buffer), NULL); priv = tepl_buffer_get_instance_private (buffer); short_name = tepl_file_get_short_name (priv->file); if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (buffer))) { short_title = g_strconcat ("*", short_name, NULL); g_free (short_name); } else { short_title = short_name; } return short_title; } /** * tepl_buffer_get_full_title: * @buffer: a #TeplBuffer. * * Returns a title suitable for a #GtkWindow title. It contains (in that order): * - the #TeplBuffer:tepl-short-title; * - the directory path in parenthesis if the #TeplFile:location isn't * %NULL. * * Returns: the @buffer full title. Free the return value with g_free() when no * longer needed. * Since: 3.0 */ gchar * tepl_buffer_get_full_title (TeplBuffer *buffer) { TeplBufferPrivate *priv; GFile *location; gchar *short_title; gchar *full_title; g_return_val_if_fail (TEPL_IS_BUFFER (buffer), NULL); priv = tepl_buffer_get_instance_private (buffer); location = tepl_file_get_location (priv->file); short_title = tepl_buffer_get_short_title (buffer); if (location != NULL && g_file_has_parent (location, NULL)) { GFile *parent; gchar *directory; gchar *directory_tilde; parent = g_file_get_parent (location); directory = g_file_get_parse_name (parent); directory_tilde = tepl_utils_replace_home_dir_with_tilde (directory); full_title = g_strdup_printf ("%s (%s)", short_title, directory_tilde); g_free (short_title); g_object_unref (parent); g_free (directory); g_free (directory_tilde); } else { full_title = short_title; } return full_title; } static void set_style_scheme_id (TeplBuffer *buffer, const gchar *style_scheme_id) { GtkSourceStyleSchemeManager *manager; GtkSourceStyleScheme *style_scheme; g_assert (style_scheme_id != NULL); manager = gtk_source_style_scheme_manager_get_default (); style_scheme = gtk_source_style_scheme_manager_get_scheme (manager, style_scheme_id); if (style_scheme == NULL) { TeplSettings *settings = tepl_settings_get_singleton (); gchar *default_style_scheme_id; default_style_scheme_id = _tepl_settings_get_default_style_scheme_id (settings); g_warning_once ("Style scheme '%s' cannot be found, falling back to '%s' default style scheme.", style_scheme_id, default_style_scheme_id); style_scheme = gtk_source_style_scheme_manager_get_scheme (manager, default_style_scheme_id); if (style_scheme == NULL) { g_warning_once ("Default style scheme '%s' cannot be found, check your installation.", default_style_scheme_id); } g_free (default_style_scheme_id); } gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (buffer), style_scheme); } static void update_style_scheme (TeplBuffer *buffer) { TeplSettings *settings; gchar *style_scheme_id; settings = tepl_settings_get_singleton (); style_scheme_id = tepl_settings_get_style_scheme_id (settings); if (style_scheme_id != NULL) { set_style_scheme_id (buffer, style_scheme_id); g_free (style_scheme_id); } } static void style_scheme_id_notify_cb (TeplSettings *settings, GParamSpec *pspec, TeplBuffer *buffer) { update_style_scheme (buffer); } /** * tepl_buffer_connect_style_scheme_settings: * @buffer: a #TeplBuffer. * * Connects #TeplSettings:style-scheme-id to #GtkSourceBuffer:style-scheme. * * Since: 6.11 */ void tepl_buffer_connect_style_scheme_settings (TeplBuffer *buffer) { TeplSettings *settings = tepl_settings_get_singleton (); g_return_if_fail (TEPL_IS_BUFFER (buffer)); g_signal_handlers_disconnect_by_func (settings, style_scheme_id_notify_cb, buffer); g_signal_connect_object (settings, "notify::style-scheme-id", G_CALLBACK (style_scheme_id_notify_cb), buffer, G_CONNECT_DEFAULT); update_style_scheme (buffer); } /** * tepl_buffer_get_selection_type: * @buffer: a #GtkTextBuffer. * * Returns: the current #TeplSelectionType. * Since: 1.0 */ TeplSelectionType tepl_buffer_get_selection_type (GtkTextBuffer *buffer) { GtkTextIter start; GtkTextIter end; gint start_line; gint end_line; g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), TEPL_SELECTION_TYPE_NO_SELECTION); if (!gtk_text_buffer_get_selection_bounds (buffer, &start, &end)) { return TEPL_SELECTION_TYPE_NO_SELECTION; } start_line = gtk_text_iter_get_line (&start); end_line = gtk_text_iter_get_line (&end); if (start_line == end_line) { return TEPL_SELECTION_TYPE_ON_SAME_LINE; } return TEPL_SELECTION_TYPE_MULTIPLE_LINES; } static void text_tag_set_highest_priority (GtkTextTag *tag, GtkTextBuffer *buffer) { GtkTextTagTable *table; gint n; table = gtk_text_buffer_get_tag_table (buffer); n = gtk_text_tag_table_get_size (table); gtk_text_tag_set_priority (tag, n - 1); } void _tepl_buffer_set_as_invalid_character (TeplBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end) { TeplBufferPrivate *priv; g_return_if_fail (TEPL_IS_BUFFER (buffer)); g_return_if_fail (start != NULL); g_return_if_fail (end != NULL); priv = tepl_buffer_get_instance_private (buffer); if (priv->invalid_char_tag == NULL) { priv->invalid_char_tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (buffer), NULL, NULL); update_invalid_char_tag_style (buffer); } /* Make sure the 'error' tag has the priority over * syntax highlighting tags. */ text_tag_set_highest_priority (priv->invalid_char_tag, GTK_TEXT_BUFFER (buffer)); gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (buffer), priv->invalid_char_tag, start, end); } gboolean _tepl_buffer_has_invalid_chars (TeplBuffer *buffer) { TeplBufferPrivate *priv; GtkTextIter start; g_return_val_if_fail (TEPL_IS_BUFFER (buffer), FALSE); priv = tepl_buffer_get_instance_private (buffer); if (priv->invalid_char_tag == NULL) { return FALSE; } gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start); if (gtk_text_iter_starts_tag (&start, priv->invalid_char_tag) || gtk_text_iter_forward_to_tag_toggle (&start, priv->invalid_char_tag)) { return TRUE; } return FALSE; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-buffer.h000066400000000000000000000043441526404732400255510ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_BUFFER_H #define TEPL_BUFFER_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include #include G_BEGIN_DECLS #define TEPL_TYPE_BUFFER (tepl_buffer_get_type ()) G_MODULE_EXPORT G_DECLARE_DERIVABLE_TYPE (TeplBuffer, tepl_buffer, TEPL, BUFFER, GtkSourceBuffer) struct _TeplBufferClass { GtkSourceBufferClass parent_class; /* Signals */ void (* tepl_cursor_moved) (TeplBuffer *buffer); gpointer padding[12]; }; /** * TeplSelectionType: * @TEPL_SELECTION_TYPE_NO_SELECTION: No selection. * @TEPL_SELECTION_TYPE_ON_SAME_LINE: The start and end selection bounds are on * the same line. * @TEPL_SELECTION_TYPE_MULTIPLE_LINES: The selection spans multiple lines. * * Since: 1.0 */ typedef enum _TeplSelectionType { TEPL_SELECTION_TYPE_NO_SELECTION, TEPL_SELECTION_TYPE_ON_SAME_LINE, TEPL_SELECTION_TYPE_MULTIPLE_LINES } TeplSelectionType; G_MODULE_EXPORT TeplBuffer * tepl_buffer_new (void); G_MODULE_EXPORT TeplFile * tepl_buffer_get_file (TeplBuffer *buffer); G_MODULE_EXPORT TeplMetadata * tepl_buffer_get_metadata (TeplBuffer *buffer); G_MODULE_EXPORT void tepl_buffer_load_metadata_from_metadata_manager (TeplBuffer *buffer); G_MODULE_EXPORT void tepl_buffer_save_metadata_into_metadata_manager (TeplBuffer *buffer); G_MODULE_EXPORT gboolean tepl_buffer_is_untouched (TeplBuffer *buffer); G_MODULE_EXPORT gchar * tepl_buffer_get_short_title (TeplBuffer *buffer); G_MODULE_EXPORT gchar * tepl_buffer_get_full_title (TeplBuffer *buffer); G_MODULE_EXPORT void tepl_buffer_connect_style_scheme_settings (TeplBuffer *buffer); G_MODULE_EXPORT TeplSelectionType tepl_buffer_get_selection_type (GtkTextBuffer *buffer); G_GNUC_INTERNAL void _tepl_buffer_set_as_invalid_character (TeplBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end); G_GNUC_INTERNAL gboolean _tepl_buffer_has_invalid_chars (TeplBuffer *buffer); G_END_DECLS #endif /* TEPL_BUFFER_H */ tepl-close-confirm-dialog-single.c000066400000000000000000000103411526404732400314620ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-close-confirm-dialog-single.h" #include #include "tepl-buffer.h" #include "tepl-file.h" #include "tepl-tab-saving.h" #include "tepl-utils.h" #define CAN_CLOSE (TRUE) #define CANNOT_CLOSE (FALSE) #define DIALOG_RESPONSE_SAVE (1) #define DIALOG_RESPONSE_SAVE_AS (2) /* When closing a TeplTab, show a message dialog if the buffer is modified. */ static void save_tab_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplTab *tab = TEPL_TAB (source_object); GTask *task = G_TASK (user_data); gboolean can_close; can_close = tepl_tab_save_finish (tab, result); g_task_return_boolean (task, can_close); g_object_unref (task); } static void save_tab (GTask *task) { TeplTab *tab; tab = g_task_get_source_object (task); tepl_tab_save_async (tab, save_tab_cb, task); } static void save_as_tab_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplTab *tab = TEPL_TAB (source_object); GTask *task = G_TASK (user_data); gboolean can_close; can_close = tepl_tab_save_as_finish (tab, result); g_task_return_boolean (task, can_close); g_object_unref (task); } static void save_as_tab (GTask *task) { TeplTab *tab; tab = g_task_get_source_object (task); tepl_tab_save_as_async (tab, save_as_tab_cb, task); } static void dialog_response_cb (GtkDialog *dialog, gint response_id, GTask *task) { if (response_id == DIALOG_RESPONSE_SAVE) { save_tab (task); } else if (response_id == DIALOG_RESPONSE_SAVE_AS) { save_as_tab (task); } else if (response_id == GTK_RESPONSE_CLOSE) { g_task_return_boolean (task, CAN_CLOSE); g_object_unref (task); } else { g_task_return_boolean (task, CANNOT_CLOSE); g_object_unref (task); } gtk_widget_destroy (GTK_WIDGET (dialog)); } static void create_dialog (GTask *task) { TeplTab *tab; TeplBuffer *buffer; TeplFile *file; GFile *location; gchar *file_short_name; GtkWidget *dialog; GtkWidget *close_button; tab = g_task_get_source_object (task); buffer = tepl_tab_get_buffer (tab); file = tepl_buffer_get_file (buffer); location = tepl_file_get_location (file); file_short_name = tepl_file_get_short_name (file); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("Save changes to file “%s” before closing?"), file_short_name); g_free (file_short_name); file_short_name = NULL; close_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Close _without Saving"), GTK_RESPONSE_CLOSE); gtk_style_context_add_class (gtk_widget_get_style_context (close_button), GTK_STYLE_CLASS_DESTRUCTIVE_ACTION); gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL); if (location != NULL) { gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Save"), DIALOG_RESPONSE_SAVE); } else { gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Save As…"), DIALOG_RESPONSE_SAVE_AS); } _tepl_utils_associate_secondary_window (GTK_WINDOW (dialog), GTK_WIDGET (tab)); g_signal_connect (dialog, "response", G_CALLBACK (dialog_response_cb), task); gtk_widget_show (dialog); } void _tepl_close_confirm_dialog_single_async (TeplTab *tab, GAsyncReadyCallback callback, gpointer user_data) { GTask *task; TeplBuffer *buffer; g_return_if_fail (TEPL_IS_TAB (tab)); task = g_task_new (tab, NULL, callback, user_data); buffer = tepl_tab_get_buffer (tab); if (!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (buffer))) { g_task_return_boolean (task, CAN_CLOSE); g_object_unref (task); return; } create_dialog (task); } /* Returns: %TRUE if @tab can be closed, %FALSE otherwise. */ gboolean _tepl_close_confirm_dialog_single_finish (TeplTab *tab, GAsyncResult *result) { g_return_val_if_fail (TEPL_IS_TAB (tab), FALSE); g_return_val_if_fail (g_task_is_valid (result, tab), FALSE); return g_task_propagate_boolean (G_TASK (result), NULL); } tepl-close-confirm-dialog-single.h000066400000000000000000000011561526404732400314730ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_CLOSE_CONFIRM_DIALOG_SINGLE_H #define TEPL_CLOSE_CONFIRM_DIALOG_SINGLE_H #include #include "tepl-tab.h" G_BEGIN_DECLS G_GNUC_INTERNAL void _tepl_close_confirm_dialog_single_async (TeplTab *tab, GAsyncReadyCallback callback, gpointer user_data); G_GNUC_INTERNAL gboolean _tepl_close_confirm_dialog_single_finish (TeplTab *tab, GAsyncResult *result); G_END_DECLS #endif /* TEPL_CLOSE_CONFIRM_DIALOG_SINGLE_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file-chooser.c000066400000000000000000000042431526404732400266500ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-file-chooser.h" /** * SECTION:file-chooser * @Title: TeplFileChooser * @Short_description: Extra functions for #GtkFileChooser * * Extra functions for #GtkFileChooser, to have common code between * #GtkFileChooserDialog and GtkFileChooserNative. */ /** * tepl_file_chooser_set_modal: * @chooser: a #GtkFileChooser. * @modal: the new value. * * Calls either gtk_native_dialog_set_modal() or gtk_window_set_modal() * depending on the @chooser type. * * Since: 5.0 */ void tepl_file_chooser_set_modal (GtkFileChooser *chooser, gboolean modal) { if (GTK_IS_NATIVE_DIALOG (chooser)) { gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (chooser), modal); } else if (GTK_IS_WINDOW (chooser)) { gtk_window_set_modal (GTK_WINDOW (chooser), modal); } else { g_warn_if_reached (); } } /** * tepl_file_chooser_set_parent: * @chooser: a #GtkFileChooser. * @parent: (nullable): a #GtkWindow, or %NULL. * * Sets or unsets a parent #GtkWindow for the @chooser dialog. It calls the * right functions depending on the type of @chooser. * * Since: 5.0 */ void tepl_file_chooser_set_parent (GtkFileChooser *chooser, GtkWindow *parent) { g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent)); if (GTK_IS_NATIVE_DIALOG (chooser)) { gtk_native_dialog_set_transient_for (GTK_NATIVE_DIALOG (chooser), parent); } else if (GTK_IS_WINDOW (chooser)) { gtk_window_set_transient_for (GTK_WINDOW (chooser), parent); if (parent != NULL) { gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE); } } else { g_warn_if_reached (); } } /** * tepl_file_chooser_show: * @chooser: a #GtkFileChooser. * * Calls gtk_native_dialog_show() or gtk_window_present() depending on the type * of @chooser. * * Since: 5.0 */ void tepl_file_chooser_show (GtkFileChooser *chooser) { if (GTK_IS_NATIVE_DIALOG (chooser)) { gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser)); } else if (GTK_IS_WINDOW (chooser)) { gtk_window_present (GTK_WINDOW (chooser)); } else { g_warn_if_reached (); } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file-chooser.h000066400000000000000000000012451526404732400266540ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_FILE_CHOOSER_H #define TEPL_FILE_CHOOSER_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT void tepl_file_chooser_set_modal (GtkFileChooser *chooser, gboolean modal); G_MODULE_EXPORT void tepl_file_chooser_set_parent (GtkFileChooser *chooser, GtkWindow *parent); G_MODULE_EXPORT void tepl_file_chooser_show (GtkFileChooser *chooser); G_END_DECLS #endif /* TEPL_FILE_CHOOSER_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file-loader.c000066400000000000000000000273431526404732400264620ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-file-loader.h" #include /** * SECTION:file-loader * @Title: TeplFileLoader * @Short_description: Load a file into a #TeplBuffer * @See_also: #TeplFile, #TeplFileSaver * * A #TeplFileLoader object permits to load the content of a #GFile into a * #TeplBuffer. * * A file loader should be used only for one load operation, including errors * handling. If an error occurs, you can reconfigure the loader and relaunch the * operation with tepl_file_loader_load_async(). * * Running a #TeplFileLoader is an undoable action for the #TeplBuffer. That is, * gtk_source_buffer_begin_not_undoable_action() and * gtk_source_buffer_end_not_undoable_action() are called, which delete the * undo/redo history. * * After a file loading, the buffer is reset to the content provided by the * #GFile, so the buffer is set as “unmodified”, that is, * gtk_text_buffer_set_modified() is called with %FALSE. */ /* To simulate for example loading a big remote file with a slow network * connection. */ #define SIMULATE_LONG_FILE_LOADING FALSE #define MAX_SIZE (20 * 1000 * 1000) /* It corresponds more or less to a line taking the full screen. */ #define MAX_N_BYTES_PER_LINE (10 * 1000) struct _TeplFileLoaderPrivate { /* Weak ref to the TeplBuffer. A strong ref could create a reference * cycle in an application. For example a subclass of TeplBuffer can * have a strong ref to the FileLoader. */ TeplBuffer *buffer; /* Weak ref to the TeplFile. A strong ref could create a reference * cycle in an application. For example a subclass of TeplFile can * have a strong ref to the FileLoader. */ TeplFile *file; GFile *location; guint is_loading : 1; }; enum { PROP_0, PROP_BUFFER, PROP_FILE, PROP_LOCATION, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplFileLoader, tepl_file_loader, G_TYPE_OBJECT) static void tepl_file_loader_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplFileLoader *loader = TEPL_FILE_LOADER (object); switch (prop_id) { case PROP_BUFFER: g_value_set_object (value, tepl_file_loader_get_buffer (loader)); break; case PROP_FILE: g_value_set_object (value, tepl_file_loader_get_file (loader)); break; case PROP_LOCATION: g_value_set_object (value, tepl_file_loader_get_location (loader)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_file_loader_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplFileLoader *loader = TEPL_FILE_LOADER (object); switch (prop_id) { case PROP_BUFFER: g_assert (loader->priv->buffer == NULL); g_set_weak_pointer (&loader->priv->buffer, g_value_get_object (value)); break; case PROP_FILE: g_assert (loader->priv->file == NULL); g_set_weak_pointer (&loader->priv->file, g_value_get_object (value)); break; case PROP_LOCATION: g_assert (loader->priv->location == NULL); loader->priv->location = g_value_dup_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_file_loader_constructed (GObject *object) { TeplFileLoader *loader = TEPL_FILE_LOADER (object); G_OBJECT_CLASS (tepl_file_loader_parent_class)->constructed (object); if (loader->priv->file != NULL && loader->priv->location == NULL) { loader->priv->location = tepl_file_get_location (loader->priv->file); if (loader->priv->location != NULL) { g_object_ref (loader->priv->location); } else { g_warning ("TeplFileLoader: the TeplFile location is NULL. " "Call tepl_file_set_location() before creating the FileLoader."); } } } static void tepl_file_loader_dispose (GObject *object) { TeplFileLoader *loader = TEPL_FILE_LOADER (object); g_clear_weak_pointer (&loader->priv->buffer); g_clear_weak_pointer (&loader->priv->file); g_clear_object (&loader->priv->location); G_OBJECT_CLASS (tepl_file_loader_parent_class)->dispose (object); } static void tepl_file_loader_class_init (TeplFileLoaderClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_file_loader_get_property; object_class->set_property = tepl_file_loader_set_property; object_class->constructed = tepl_file_loader_constructed; object_class->dispose = tepl_file_loader_dispose; /** * TeplFileLoader:buffer: * * The #TeplBuffer to load the content into. The #TeplFileLoader object * has a weak reference to the buffer. * * Since: 1.0 */ properties[PROP_BUFFER] = g_param_spec_object ("buffer", "buffer", "", TEPL_TYPE_BUFFER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplFileLoader:file: * * The #TeplFile. The #TeplFileLoader object has a weak * reference to the file. * * Since: 1.0 */ properties[PROP_FILE] = g_param_spec_object ("file", "file", "", TEPL_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplFileLoader:location: * * The #GFile to load. By default the location is taken from the * #TeplFile at construction time. * * Since: 1.0 */ properties[PROP_LOCATION] = g_param_spec_object ("location", "location", "", G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_file_loader_init (TeplFileLoader *loader) { loader->priv = tepl_file_loader_get_instance_private (loader); } /** * tepl_file_loader_new: * @buffer: the #TeplBuffer to load the content into. * @file: the #TeplFile. * * Creates a new #TeplFileLoader object. The content is read from the #TeplFile * location. * * If not already done, call tepl_file_set_location() before calling this * constructor. The previous location is anyway not needed, because as soon as * the file loading begins, the @buffer is emptied. Setting the #TeplFile * location directly permits to update the UI, to display the good location when * the file is loading. * * Returns: a new #TeplFileLoader object. * Since: 1.0 */ TeplFileLoader * tepl_file_loader_new (TeplBuffer *buffer, TeplFile *file) { g_return_val_if_fail (TEPL_IS_BUFFER (buffer), NULL); g_return_val_if_fail (TEPL_IS_FILE (file), NULL); return g_object_new (TEPL_TYPE_FILE_LOADER, "buffer", buffer, "file", file, NULL); } /** * tepl_file_loader_get_buffer: * @loader: a #TeplFileLoader. * * Returns: (transfer none) (nullable): the #TeplBuffer to load the content * into. * Since: 1.0 */ TeplBuffer * tepl_file_loader_get_buffer (TeplFileLoader *loader) { g_return_val_if_fail (TEPL_IS_FILE_LOADER (loader), NULL); return loader->priv->buffer; } /** * tepl_file_loader_get_file: * @loader: a #TeplFileLoader. * * Returns: (transfer none) (nullable): the #TeplFile. * Since: 1.0 */ TeplFile * tepl_file_loader_get_file (TeplFileLoader *loader) { g_return_val_if_fail (TEPL_IS_FILE_LOADER (loader), NULL); return loader->priv->file; } /** * tepl_file_loader_get_location: * @loader: a #TeplFileLoader. * * Returns: (transfer none) (nullable): the #GFile to load. * Since: 1.0 */ GFile * tepl_file_loader_get_location (TeplFileLoader *loader) { g_return_val_if_fail (TEPL_IS_FILE_LOADER (loader), NULL); return loader->priv->location; } static void load_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { GFile *location = G_FILE (source_object); GTask *task = G_TASK (user_data); TeplFileLoader *loader = g_task_get_source_object (task); GBytes *content; GError *error = NULL; content = gfls_loader_basic_load_finish (location, result, &error); if (error != NULL) { g_task_return_error (task, error); g_object_unref (task); g_bytes_unref (content); return; } if (loader->priv->buffer != NULL) { GtkTextBuffer *text_buffer = GTK_TEXT_BUFFER (loader->priv->buffer); GtkTextIter start; gtk_text_buffer_set_text (text_buffer, g_bytes_get_data (content, NULL), g_bytes_get_size (content)); gtk_text_buffer_get_start_iter (text_buffer, &start); gtk_text_buffer_place_cursor (text_buffer, &start); } /* Free memory ASAP. */ g_bytes_unref (content); g_task_return_boolean (task, TRUE); g_object_unref (task); } static void start_load (GTask *task) { TeplFileLoader *loader = g_task_get_source_object (task); gfls_loader_basic_load_async (loader->priv->location, MAX_SIZE, MAX_N_BYTES_PER_LINE, g_task_get_priority (task), g_task_get_cancellable (task), load_cb, task); } #if SIMULATE_LONG_FILE_LOADING static gboolean simulate_long_file_loading_timeout_cb (gpointer user_data) { GTask *task = G_TASK (user_data); g_message ("%s()", G_STRFUNC); start_load (task); return G_SOURCE_REMOVE; } #endif /** * tepl_file_loader_load_async: * @loader: a #TeplFileLoader. * @io_priority: the I/O priority of the request. E.g. %G_PRIORITY_LOW, * %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH. * @cancellable: (nullable): optional #GCancellable object, %NULL to ignore. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is * satisfied. * @user_data: user data to pass to @callback. * * Loads asynchronously the file content into the #TeplBuffer. * * See the #GAsyncResult documentation to know how to use this function. * * Since: 5.0 */ void tepl_file_loader_load_async (TeplFileLoader *loader, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { GTask *task; g_return_if_fail (TEPL_IS_FILE_LOADER (loader)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); g_return_if_fail (!loader->priv->is_loading); loader->priv->is_loading = TRUE; task = g_task_new (loader, cancellable, callback, user_data); g_task_set_priority (task, io_priority); if (loader->priv->buffer == NULL || loader->priv->file == NULL || loader->priv->location == NULL) { g_task_return_boolean (task, FALSE); g_object_unref (task); return; } gtk_source_buffer_begin_not_undoable_action (GTK_SOURCE_BUFFER (loader->priv->buffer)); gtk_text_buffer_set_text (GTK_TEXT_BUFFER (loader->priv->buffer), "", -1); gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (loader->priv->buffer), FALSE); #if SIMULATE_LONG_FILE_LOADING g_timeout_add_seconds (5, simulate_long_file_loading_timeout_cb, task); #else start_load (task); #endif } /** * tepl_file_loader_load_finish: * @loader: a #TeplFileLoader. * @result: a #GAsyncResult. * @error: a #GError, or %NULL. * * Finishes a file loading started with tepl_file_loader_load_async(). * * Returns: whether the content has been loaded successfully. * Since: 1.0 */ gboolean tepl_file_loader_load_finish (TeplFileLoader *loader, GAsyncResult *result, GError **error) { g_return_val_if_fail (TEPL_IS_FILE_LOADER (loader), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (g_task_is_valid (result, loader), FALSE); if (loader->priv->buffer != NULL) { gtk_source_buffer_end_not_undoable_action (GTK_SOURCE_BUFFER (loader->priv->buffer)); gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (loader->priv->buffer), FALSE); } loader->priv->is_loading = FALSE; return g_task_propagate_boolean (G_TASK (result), error); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file-loader.h000066400000000000000000000043051526404732400264600ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_FILE_LOADER_H #define TEPL_FILE_LOADER_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include #include G_BEGIN_DECLS #define TEPL_TYPE_FILE_LOADER (tepl_file_loader_get_type ()) #define TEPL_FILE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_FILE_LOADER, TeplFileLoader)) #define TEPL_FILE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_FILE_LOADER, TeplFileLoaderClass)) #define TEPL_IS_FILE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_FILE_LOADER)) #define TEPL_IS_FILE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_FILE_LOADER)) #define TEPL_FILE_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_FILE_LOADER, TeplFileLoaderClass)) typedef struct _TeplFileLoader TeplFileLoader; typedef struct _TeplFileLoaderClass TeplFileLoaderClass; typedef struct _TeplFileLoaderPrivate TeplFileLoaderPrivate; struct _TeplFileLoader { GObject parent; TeplFileLoaderPrivate *priv; }; struct _TeplFileLoaderClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_file_loader_get_type (void); G_MODULE_EXPORT TeplFileLoader * tepl_file_loader_new (TeplBuffer *buffer, TeplFile *file); G_MODULE_EXPORT TeplBuffer * tepl_file_loader_get_buffer (TeplFileLoader *loader); G_MODULE_EXPORT TeplFile * tepl_file_loader_get_file (TeplFileLoader *loader); G_MODULE_EXPORT GFile * tepl_file_loader_get_location (TeplFileLoader *loader); G_MODULE_EXPORT void tepl_file_loader_load_async (TeplFileLoader *loader, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); G_MODULE_EXPORT gboolean tepl_file_loader_load_finish (TeplFileLoader *loader, GAsyncResult *result, GError **error); G_END_DECLS #endif /* TEPL_FILE_LOADER_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file-saver.c000066400000000000000000000374501526404732400263340ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2005-2007 - Paolo Borelli and Paolo Maggi * SPDX-FileCopyrightText: 2007 - Steve Frécinaux * SPDX-FileCopyrightText: 2008 - Jesse van den Kieboom * SPDX-FileCopyrightText: 2014-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-file-saver.h" #include #include "tepl-enum-types.h" /** * SECTION:file-saver * @Title: TeplFileSaver * @Short_description: Save a #TeplBuffer into a file * @See_also: #TeplFile, #TeplFileLoader * * A #TeplFileSaver object permits to save a #TeplBuffer into a #GFile. * * A file saver should be used only for one save operation, including errors * handling. If an error occurs, you can reconfigure the saver and relaunch the * operation with tepl_file_saver_save_async(). * * # Things that need to be done at a higher level * * Make the #GtkTextView non-editable during the save operation. See * gtk_text_view_set_editable(). Because the save operation is asynchronous, and * gtk_text_buffer_set_modified() must be called (with a %FALSE value) only when * the file has been successfully saved. So that's why * gtk_text_buffer_set_modified() is called by tepl_file_saver_save_finish(), * not at the beginning of the save operation. If the view/buffer is editable * during the save operation, gtk_text_buffer_set_modified() may be called at * the wrong place in the undo/redo history. */ enum { PROP_0, PROP_BUFFER, PROP_FILE, PROP_LOCATION, PROP_NEWLINE_TYPE, PROP_FLAGS, N_PROPERTIES }; struct _TeplFileSaverPrivate { /* Weak ref to the TeplBuffer. A strong ref could create a reference * cycle in an application. For example a subclass of TeplBuffer can * have a strong ref to the FileSaver. */ TeplBuffer *buffer; /* Weak ref to the TeplFile. A strong ref could create a reference * cycle in an application. For example a subclass of TeplFile can * have a strong ref to the FileSaver. */ TeplFile *file; GFile *location; TeplNewlineType newline_type; TeplFileSaverFlags flags; guint is_saving : 1; }; typedef struct _TaskData TaskData; struct _TaskData { gchar *buffer_content; }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplFileSaver, tepl_file_saver, G_TYPE_OBJECT) static TaskData * task_data_new (void) { return g_new0 (TaskData, 1); } static void task_data_free (TaskData *data) { if (data != NULL) { g_free (data->buffer_content); g_free (data); } } static void tepl_file_saver_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplFileSaver *saver = TEPL_FILE_SAVER (object); switch (prop_id) { case PROP_BUFFER: g_assert (saver->priv->buffer == NULL); g_set_weak_pointer (&saver->priv->buffer, g_value_get_object (value)); break; case PROP_FILE: g_assert (saver->priv->file == NULL); g_set_weak_pointer (&saver->priv->file, g_value_get_object (value)); break; case PROP_LOCATION: g_assert (saver->priv->location == NULL); saver->priv->location = g_value_dup_object (value); break; case PROP_NEWLINE_TYPE: tepl_file_saver_set_newline_type (saver, g_value_get_enum (value)); break; case PROP_FLAGS: tepl_file_saver_set_flags (saver, g_value_get_flags (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_file_saver_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplFileSaver *saver = TEPL_FILE_SAVER (object); switch (prop_id) { case PROP_BUFFER: g_value_set_object (value, saver->priv->buffer); break; case PROP_FILE: g_value_set_object (value, saver->priv->file); break; case PROP_LOCATION: g_value_set_object (value, saver->priv->location); break; case PROP_NEWLINE_TYPE: g_value_set_enum (value, saver->priv->newline_type); break; case PROP_FLAGS: g_value_set_flags (value, saver->priv->flags); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_file_saver_constructed (GObject *object) { TeplFileSaver *saver = TEPL_FILE_SAVER (object); if (saver->priv->file != NULL) { TeplNewlineType newline_type; newline_type = tepl_file_get_newline_type (saver->priv->file); tepl_file_saver_set_newline_type (saver, newline_type); if (saver->priv->location == NULL) { saver->priv->location = tepl_file_get_location (saver->priv->file); if (saver->priv->location != NULL) { g_object_ref (saver->priv->location); } else { g_warning ("TeplFileSaver: the TeplFile's location is NULL. " "Use tepl_file_saver_new_with_target()."); } } } G_OBJECT_CLASS (tepl_file_saver_parent_class)->constructed (object); } static void tepl_file_saver_dispose (GObject *object) { TeplFileSaver *saver = TEPL_FILE_SAVER (object); g_clear_weak_pointer (&saver->priv->buffer); g_clear_weak_pointer (&saver->priv->file); g_clear_object (&saver->priv->location); G_OBJECT_CLASS (tepl_file_saver_parent_class)->dispose (object); } static void tepl_file_saver_class_init (TeplFileSaverClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->set_property = tepl_file_saver_set_property; object_class->get_property = tepl_file_saver_get_property; object_class->constructed = tepl_file_saver_constructed; object_class->dispose = tepl_file_saver_dispose; /** * TeplFileSaver:buffer: * * The #TeplBuffer to save. The #TeplFileSaver object has a weak * reference to the buffer. * * Since: 1.0 */ properties[PROP_BUFFER] = g_param_spec_object ("buffer", "buffer", "", TEPL_TYPE_BUFFER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplFileSaver:file: * * The #TeplFile. The #TeplFileSaver object has a weak reference to the * file. * * Since: 1.0 */ properties[PROP_FILE] = g_param_spec_object ("file", "file", "", TEPL_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplFileSaver:location: * * The #GFile where to save the buffer. By default the location is taken * from the #TeplFile at construction time. * * Since: 1.0 */ properties[PROP_LOCATION] = g_param_spec_object ("location", "location", "", G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplFileSaver:newline-type: * * The newline type. * * Since: 1.0 */ properties[PROP_NEWLINE_TYPE] = g_param_spec_enum ("newline-type", "newline-type", "", TEPL_TYPE_NEWLINE_TYPE, TEPL_NEWLINE_TYPE_DEFAULT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); /** * TeplFileSaver:flags: * * File saving flags. * * Since: 1.0 */ properties[PROP_FLAGS] = g_param_spec_flags ("flags", "flags", "", TEPL_TYPE_FILE_SAVER_FLAGS, TEPL_FILE_SAVER_FLAGS_NONE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_file_saver_init (TeplFileSaver *saver) { saver->priv = tepl_file_saver_get_instance_private (saver); saver->priv->newline_type = TEPL_NEWLINE_TYPE_DEFAULT; saver->priv->flags = TEPL_FILE_SAVER_FLAGS_NONE; } /** * tepl_file_saver_new: * @buffer: the #TeplBuffer to save. * @file: the #TeplFile. * * Creates a new #TeplFileSaver object. The @buffer will be saved to the * #TeplFile's location. * * This constructor is suitable for a simple "save" operation, when the @file * already contains a non-%NULL #TeplFile:location. * * Returns: a new #TeplFileSaver object. * Since: 1.0 */ TeplFileSaver * tepl_file_saver_new (TeplBuffer *buffer, TeplFile *file) { g_return_val_if_fail (TEPL_IS_BUFFER (buffer), NULL); g_return_val_if_fail (TEPL_IS_FILE (file), NULL); return g_object_new (TEPL_TYPE_FILE_SAVER, "buffer", buffer, "file", file, NULL); } /** * tepl_file_saver_new_with_target: * @buffer: the #TeplBuffer to save. * @file: the #TeplFile. * @target_location: the #GFile where to save the buffer to. * * Creates a new #TeplFileSaver object with a target location. When the * file saving is finished successfully, @target_location is set to the @file's * #TeplFile:location property. If an error occurs, the previous valid * location is still available in #TeplFile. * * This constructor is suitable for a "save as" operation, or for saving a new * buffer for the first time. * * Returns: a new #TeplFileSaver object. * Since: 1.0 */ TeplFileSaver * tepl_file_saver_new_with_target (TeplBuffer *buffer, TeplFile *file, GFile *target_location) { g_return_val_if_fail (TEPL_IS_BUFFER (buffer), NULL); g_return_val_if_fail (TEPL_IS_FILE (file), NULL); g_return_val_if_fail (G_IS_FILE (target_location), NULL); return g_object_new (TEPL_TYPE_FILE_SAVER, "buffer", buffer, "file", file, "location", target_location, NULL); } /** * tepl_file_saver_get_buffer: * @saver: a #TeplFileSaver. * * Returns: (transfer none): the #TeplBuffer to save. * Since: 1.0 */ TeplBuffer * tepl_file_saver_get_buffer (TeplFileSaver *saver) { g_return_val_if_fail (TEPL_IS_FILE_SAVER (saver), NULL); return saver->priv->buffer; } /** * tepl_file_saver_get_file: * @saver: a #TeplFileSaver. * * Returns: (transfer none): the #TeplFile. * Since: 1.0 */ TeplFile * tepl_file_saver_get_file (TeplFileSaver *saver) { g_return_val_if_fail (TEPL_IS_FILE_SAVER (saver), NULL); return saver->priv->file; } /** * tepl_file_saver_get_location: * @saver: a #TeplFileSaver. * * Returns: (transfer none): the #GFile where to save the buffer to. * Since: 1.0 */ GFile * tepl_file_saver_get_location (TeplFileSaver *saver) { g_return_val_if_fail (TEPL_IS_FILE_SAVER (saver), NULL); return saver->priv->location; } /** * tepl_file_saver_set_newline_type: * @saver: a #TeplFileSaver. * @newline_type: the new newline type. * * Sets the newline type. By default the newline type is taken from the * #TeplFile. * * Since: 1.0 */ void tepl_file_saver_set_newline_type (TeplFileSaver *saver, TeplNewlineType newline_type) { g_return_if_fail (TEPL_IS_FILE_SAVER (saver)); g_return_if_fail (!saver->priv->is_saving); if (saver->priv->newline_type != newline_type) { saver->priv->newline_type = newline_type; g_object_notify_by_pspec (G_OBJECT (saver), properties[PROP_NEWLINE_TYPE]); } } /** * tepl_file_saver_get_newline_type: * @saver: a #TeplFileSaver. * * Returns: the newline type. * Since: 1.0 */ TeplNewlineType tepl_file_saver_get_newline_type (TeplFileSaver *saver) { g_return_val_if_fail (TEPL_IS_FILE_SAVER (saver), TEPL_NEWLINE_TYPE_DEFAULT); return saver->priv->newline_type; } /** * tepl_file_saver_set_flags: * @saver: a #TeplFileSaver. * @flags: the new flags. * * Since: 1.0 */ void tepl_file_saver_set_flags (TeplFileSaver *saver, TeplFileSaverFlags flags) { g_return_if_fail (TEPL_IS_FILE_SAVER (saver)); g_return_if_fail (!saver->priv->is_saving); if (saver->priv->flags != flags) { saver->priv->flags = flags; g_object_notify_by_pspec (G_OBJECT (saver), properties[PROP_FLAGS]); } } /** * tepl_file_saver_get_flags: * @saver: a #TeplFileSaver. * * Returns: the flags. * Since: 1.0 */ TeplFileSaverFlags tepl_file_saver_get_flags (TeplFileSaver *saver) { g_return_val_if_fail (TEPL_IS_FILE_SAVER (saver), TEPL_FILE_SAVER_FLAGS_NONE); return saver->priv->flags; } static void get_all_buffer_content (GTask *task) { TeplFileSaver *saver = g_task_get_source_object (task); TaskData *task_data = g_task_get_task_data (task); GtkTextIter start; GtkTextIter end; gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (saver->priv->buffer), &start, &end); g_free (task_data->buffer_content); task_data->buffer_content = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (saver->priv->buffer), &start, &end, TRUE); } static void save_all_buffer_content_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { GFile *location = G_FILE (source_object); GTask *task = G_TASK (user_data); GError *error = NULL; g_file_replace_contents_finish (location, result, NULL, &error); if (error != NULL) { g_task_return_error (task, error); g_object_unref (task); return; } g_task_return_boolean (task, TRUE); g_object_unref (task); } static void save_all_buffer_content (GTask *task) { TeplFileSaver *saver = g_task_get_source_object (task); TaskData *task_data = g_task_get_task_data (task); gboolean make_backup; make_backup = (saver->priv->flags & TEPL_FILE_SAVER_FLAGS_CREATE_BACKUP) != 0; g_file_replace_contents_async (saver->priv->location, task_data->buffer_content, strlen (task_data->buffer_content), NULL, make_backup, G_FILE_CREATE_NONE, g_task_get_cancellable (task), save_all_buffer_content_cb, task); } /** * tepl_file_saver_save_async: * @saver: a #TeplFileSaver. * @io_priority: the I/O priority of the request. E.g. %G_PRIORITY_LOW, * %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH. * @cancellable: (nullable): optional #GCancellable object, %NULL to ignore. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is * satisfied. * @user_data: user data to pass to @callback. * * Saves asynchronously the buffer into the file. See the #GAsyncResult * documentation to know how to use this function. * * Since: 5.0 */ void tepl_file_saver_save_async (TeplFileSaver *saver, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { GTask *task; TaskData *task_data; g_return_if_fail (TEPL_IS_FILE_SAVER (saver)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); g_return_if_fail (!saver->priv->is_saving); saver->priv->is_saving = TRUE; task = g_task_new (saver, cancellable, callback, user_data); g_task_set_priority (task, io_priority); task_data = task_data_new (); g_task_set_task_data (task, task_data, (GDestroyNotify)task_data_free); if (saver->priv->buffer == NULL || saver->priv->file == NULL || saver->priv->location == NULL) { g_task_return_boolean (task, FALSE); g_object_unref (task); return; } get_all_buffer_content (task); save_all_buffer_content (task); } /** * tepl_file_saver_save_finish: * @saver: a #TeplFileSaver. * @result: a #GAsyncResult. * @error: a #GError, or %NULL. * * Finishes a file saving started with tepl_file_saver_save_async(). * * If the file has been saved successfully, the following #TeplFile * properties will be updated: the location and the newline type. * * gtk_text_buffer_set_modified() is called with %FALSE if the file has been * saved successfully. * * Returns: whether the file was saved successfully. * Since: 1.0 */ gboolean tepl_file_saver_save_finish (TeplFileSaver *saver, GAsyncResult *result, GError **error) { gboolean ok; g_return_val_if_fail (TEPL_IS_FILE_SAVER (saver), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (g_task_is_valid (result, saver), FALSE); ok = g_task_propagate_boolean (G_TASK (result), error); if (ok && saver->priv->file != NULL) { tepl_file_set_location (saver->priv->file, saver->priv->location); _tepl_file_set_newline_type (saver->priv->file, saver->priv->newline_type); } if (ok && saver->priv->buffer != NULL) { gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (saver->priv->buffer), FALSE); } saver->priv->is_saving = FALSE; return ok; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file-saver.h000066400000000000000000000062551526404732400263400ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2005, 2007 - Paolo Maggi * SPDX-FileCopyrightText: 2007 - Steve Frécinaux * SPDX-FileCopyrightText: 2008 - Jesse van den Kieboom * SPDX-FileCopyrightText: 2014-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_FILE_SAVER_H #define TEPL_FILE_SAVER_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS #define TEPL_TYPE_FILE_SAVER (tepl_file_saver_get_type()) #define TEPL_FILE_SAVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TEPL_TYPE_FILE_SAVER, TeplFileSaver)) #define TEPL_FILE_SAVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TEPL_TYPE_FILE_SAVER, TeplFileSaverClass)) #define TEPL_IS_FILE_SAVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TEPL_TYPE_FILE_SAVER)) #define TEPL_IS_FILE_SAVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_FILE_SAVER)) #define TEPL_FILE_SAVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TEPL_TYPE_FILE_SAVER, TeplFileSaverClass)) typedef struct _TeplFileSaver TeplFileSaver; typedef struct _TeplFileSaverClass TeplFileSaverClass; typedef struct _TeplFileSaverPrivate TeplFileSaverPrivate; /** * TeplFileSaverFlags: * @TEPL_FILE_SAVER_FLAGS_NONE: No flags. * @TEPL_FILE_SAVER_FLAGS_CREATE_BACKUP: Create a backup before saving the file. * * Flags to define the behavior of a #TeplFileSaver. * * Since: 1.0 */ typedef enum { TEPL_FILE_SAVER_FLAGS_NONE = 0, TEPL_FILE_SAVER_FLAGS_CREATE_BACKUP = 1 << 0 } TeplFileSaverFlags; struct _TeplFileSaver { GObject object; TeplFileSaverPrivate *priv; }; struct _TeplFileSaverClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_file_saver_get_type (void); G_MODULE_EXPORT TeplFileSaver * tepl_file_saver_new (TeplBuffer *buffer, TeplFile *file); G_MODULE_EXPORT TeplFileSaver * tepl_file_saver_new_with_target (TeplBuffer *buffer, TeplFile *file, GFile *target_location); G_MODULE_EXPORT TeplBuffer * tepl_file_saver_get_buffer (TeplFileSaver *saver); G_MODULE_EXPORT TeplFile * tepl_file_saver_get_file (TeplFileSaver *saver); G_MODULE_EXPORT GFile * tepl_file_saver_get_location (TeplFileSaver *saver); G_MODULE_EXPORT void tepl_file_saver_set_newline_type (TeplFileSaver *saver, TeplNewlineType newline_type); G_MODULE_EXPORT TeplNewlineType tepl_file_saver_get_newline_type (TeplFileSaver *saver); G_MODULE_EXPORT void tepl_file_saver_set_flags (TeplFileSaver *saver, TeplFileSaverFlags flags); G_MODULE_EXPORT TeplFileSaverFlags tepl_file_saver_get_flags (TeplFileSaver *saver); G_MODULE_EXPORT void tepl_file_saver_save_async (TeplFileSaver *saver, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); G_MODULE_EXPORT gboolean tepl_file_saver_save_finish (TeplFileSaver *saver, GAsyncResult *result, GError **error); G_END_DECLS #endif /* TEPL_FILE_SAVER_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file.c000066400000000000000000000353471526404732400252210ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-file.h" #include #include "tepl-utils.h" #include "tepl-enum-types.h" /** * SECTION:file * @Title: TeplFile * @Short_description: On-disk representation of a #TeplBuffer * @See_also: #TeplFileLoader, #TeplFileSaver * * A #TeplFile object is the on-disk representation of a #TeplBuffer. * * With a #TeplFile, you can create and configure a #TeplFileLoader and * #TeplFileSaver which take by default the values of the #TeplFile properties * (except for the file loader which auto-detects some properties). On a * successful load or save operation, the #TeplFile properties are updated. If * an operation fails, the #TeplFile properties have still the previous valid * values. * * It is possible to use #TeplFile without using #TeplFileLoader and * #TeplFileSaver. #TeplFile alone offers several features useful for a text * editor. * * When using #TeplFile alone, #TeplFile does the I/O operations (if any) * asynchronously. */ struct _TeplFilePrivate { GFile *location; TeplNewlineType newline_type; /* For the short-name. */ gint unsaved_document_number; gchar *display_name; TeplMountOperationFactory mount_operation_factory; gpointer mount_operation_userdata; GDestroyNotify mount_operation_notify; /* Last known entity tag of 'location'. The value is updated on a file * loading or file saving. */ gchar *etag; }; enum { PROP_0, PROP_LOCATION, PROP_NEWLINE_TYPE, PROP_SHORT_NAME, PROP_FULL_NAME, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplFile, tepl_file, G_TYPE_OBJECT) static void tepl_file_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplFile *file = TEPL_FILE (object); switch (prop_id) { case PROP_LOCATION: g_value_set_object (value, tepl_file_get_location (file)); break; case PROP_NEWLINE_TYPE: g_value_set_enum (value, tepl_file_get_newline_type (file)); break; case PROP_SHORT_NAME: g_value_take_string (value, tepl_file_get_short_name (file)); break; case PROP_FULL_NAME: g_value_take_string (value, tepl_file_get_full_name (file)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_file_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplFile *file = TEPL_FILE (object); switch (prop_id) { case PROP_LOCATION: tepl_file_set_location (file, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_file_dispose (GObject *object) { TeplFile *file = TEPL_FILE (object); g_clear_object (&file->priv->location); if (file->priv->mount_operation_notify != NULL) { file->priv->mount_operation_notify (file->priv->mount_operation_userdata); file->priv->mount_operation_notify = NULL; } G_OBJECT_CLASS (tepl_file_parent_class)->dispose (object); } static void tepl_file_finalize (GObject *object) { TeplFile *file = TEPL_FILE (object); if (file->priv->unsaved_document_number > 0) { GflsUnsavedDocumentTitles *titles; titles = gfls_unsaved_document_titles_get_default (); gfls_unsaved_document_titles_release_number (titles, file->priv->unsaved_document_number); } g_free (file->priv->display_name); g_free (file->priv->etag); G_OBJECT_CLASS (tepl_file_parent_class)->finalize (object); } static void tepl_file_class_init (TeplFileClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_file_get_property; object_class->set_property = tepl_file_set_property; object_class->dispose = tepl_file_dispose; object_class->finalize = tepl_file_finalize; /** * TeplFile:location: * * The location. * * Since: 1.0 */ properties[PROP_LOCATION] = g_param_spec_object ("location", "location", "", G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); /** * TeplFile:newline-type: * * The line ending type. * * Since: 1.0 */ properties[PROP_NEWLINE_TYPE] = g_param_spec_enum ("newline-type", "newline-type", "", TEPL_TYPE_NEWLINE_TYPE, TEPL_NEWLINE_TYPE_DEFAULT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** * TeplFile:short-name: * * The file short name. * * When the #TeplFile:location is %NULL, the default instance of * #GflsUnsavedDocumentTitles is used to get a title. * * When the #TeplFile:location is not %NULL, this property contains the * display-name (see #G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME). However, * requesting the display-name can take some time (for example for a * remote file with a slow network connection). When the * #TeplFile:location property is set, the display-name is fetched * asynchronously. When the display-name is available, this property is * notified. In the meantime – after the #TeplFile:location is set but * before receiving the display-name – a fallback implementation is used * that does no blocking I/O (but it may return a different result * compared to the real display-name). * * Since: 1.0 */ properties[PROP_SHORT_NAME] = g_param_spec_string ("short-name", "short-name", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** * TeplFile:full-name: * * Convenience property for the full name of a #TeplFile. * * When the #TeplFile:location is %NULL, this property has the same * value as the #TeplFile:short-name. * * When the #TeplFile:location is not %NULL, this property contains the * full path to the location. It uses: * - g_file_get_parse_name() * - tepl_utils_replace_home_dir_with_tilde() */ properties[PROP_FULL_NAME] = g_param_spec_string ("full-name", "full-name", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void query_display_name_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { GFile *location = G_FILE (source_object); TeplFile *file = TEPL_FILE (user_data); GFileInfo *info; info = g_file_query_info_finish (location, result, NULL); /* Note: we ignore errors here, because there is no GError to report it. * The same error will probably occur when the user will load or save * the file, and in that case the FileLoader or FileSaver can report a * GError which can be displayed at an appropriate place in the UI. * * When querying the display name fails, the fallback short-name is used * instead. */ if (info != NULL) { g_free (file->priv->display_name); file->priv->display_name = g_strdup (g_file_info_get_display_name (info)); g_object_unref (info); } g_object_notify_by_pspec (G_OBJECT (file), properties[PROP_SHORT_NAME]); /* Async operation finished. */ g_object_unref (file); } static void update_short_name (TeplFile *file) { GflsUnsavedDocumentTitles *titles; titles = gfls_unsaved_document_titles_get_default (); if (file->priv->location == NULL) { g_free (file->priv->display_name); file->priv->display_name = NULL; if (file->priv->unsaved_document_number == 0) { file->priv->unsaved_document_number = gfls_unsaved_document_titles_allocate_number (titles); } g_object_notify_by_pspec (G_OBJECT (file), properties[PROP_SHORT_NAME]); return; } if (file->priv->unsaved_document_number > 0) { gfls_unsaved_document_titles_release_number (titles, file->priv->unsaved_document_number); file->priv->unsaved_document_number = 0; } /* Special case for URIs like "https://example.net". Querying the * display-name for those URIs return "/", which can be confused with * the local root directory. */ if (!g_file_has_uri_scheme (file->priv->location, "file") && !g_file_has_parent (file->priv->location, NULL)) { g_free (file->priv->display_name); file->priv->display_name = NULL; g_object_notify_by_pspec (G_OBJECT (file), properties[PROP_SHORT_NAME]); return; } /* Note: fetching the display name can take a lot of time, for example * for a remote location with a slow response time. * Tested with Slowwly, a test service to mock a slow http response: * http://slowwly.robertomurray.co.uk/ * * Note 2: the GFile location needs to really exist, if the file is not * found, then querying the display name fails. */ g_file_query_info_async (file->priv->location, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, query_display_name_cb, g_object_ref (file)); } static void tepl_file_init (TeplFile *file) { file->priv = tepl_file_get_instance_private (file); file->priv->newline_type = TEPL_NEWLINE_TYPE_DEFAULT; update_short_name (file); } /** * tepl_file_new: * * Returns: a new #TeplFile object. * Since: 1.0 */ TeplFile * tepl_file_new (void) { return g_object_new (TEPL_TYPE_FILE, NULL); } /** * tepl_file_set_location: * @file: a #TeplFile. * @location: (nullable): the new #GFile, or %NULL. * * Sets the #TeplFile:location property. * * Since: 1.0 */ void tepl_file_set_location (TeplFile *file, GFile *location) { g_return_if_fail (TEPL_IS_FILE (file)); g_return_if_fail (location == NULL || G_IS_FILE (location)); if (g_set_object (&file->priv->location, location)) { /* The etag is for the old location. */ g_free (file->priv->etag); file->priv->etag = NULL; g_free (file->priv->display_name); file->priv->display_name = NULL; update_short_name (file); g_object_notify_by_pspec (G_OBJECT (file), properties[PROP_LOCATION]); g_object_notify_by_pspec (G_OBJECT (file), properties[PROP_FULL_NAME]); } } /** * tepl_file_get_location: * @file: a #TeplFile. * * Returns: (transfer none): the value of the #TeplFile:location property. * Since: 1.0 */ GFile * tepl_file_get_location (TeplFile *file) { g_return_val_if_fail (TEPL_IS_FILE (file), NULL); return file->priv->location; } /** * tepl_file_get_short_name: * @file: a #TeplFile. * * Returns: the value of the #TeplFile:short-name property. Free with g_free(). * Since: 5.0 */ gchar * tepl_file_get_short_name (TeplFile *file) { g_return_val_if_fail (TEPL_IS_FILE (file), NULL); if (file->priv->unsaved_document_number > 0) { GflsUnsavedDocumentTitles *titles; titles = gfls_unsaved_document_titles_get_default (); return gfls_unsaved_document_titles_get_title (titles, file->priv->unsaved_document_number); } if (file->priv->display_name != NULL) { return g_strdup (file->priv->display_name); } return _tepl_utils_get_fallback_basename_for_display (file->priv->location); } /** * tepl_file_get_full_name: * @file: a #TeplFile. * * Returns: the value of the #TeplFile:full-name property. Free with g_free(). * Since: 6.4 */ gchar * tepl_file_get_full_name (TeplFile *file) { gchar *parse_name; gchar *full_name; g_return_val_if_fail (TEPL_IS_FILE (file), NULL); if (file->priv->location == NULL) { return tepl_file_get_short_name (file); } parse_name = g_file_get_parse_name (file->priv->location); full_name = tepl_utils_replace_home_dir_with_tilde (parse_name); g_free (parse_name); return full_name; } void _tepl_file_set_newline_type (TeplFile *file, TeplNewlineType newline_type) { g_return_if_fail (TEPL_IS_FILE (file)); if (file->priv->newline_type != newline_type) { file->priv->newline_type = newline_type; g_object_notify_by_pspec (G_OBJECT (file), properties[PROP_NEWLINE_TYPE]); } } /** * tepl_file_get_newline_type: * @file: a #TeplFile. * * Returns: the value of the #TeplFile:newline-type property. * Since: 1.0 */ TeplNewlineType tepl_file_get_newline_type (TeplFile *file) { g_return_val_if_fail (TEPL_IS_FILE (file), TEPL_NEWLINE_TYPE_DEFAULT); return file->priv->newline_type; } /** * tepl_file_set_mount_operation_factory: * @file: a #TeplFile. * @callback: (scope notified): a #TeplMountOperationFactory to call when a * #GMountOperation is needed. * @user_data: the data to pass to the @callback function. * @notify: (nullable): function to call on @user_data when the @callback is no * longer needed, or %NULL. * * Sets a #TeplMountOperationFactory function that will be called when a * #GMountOperation must be created. This is useful for creating a * #GtkMountOperation with the parent #GtkWindow. * * If a mount operation factory isn't set, g_mount_operation_new() will be * called. * * Since: 1.0 */ void tepl_file_set_mount_operation_factory (TeplFile *file, TeplMountOperationFactory callback, gpointer user_data, GDestroyNotify notify) { g_return_if_fail (TEPL_IS_FILE (file)); if (file->priv->mount_operation_notify != NULL) { file->priv->mount_operation_notify (file->priv->mount_operation_userdata); } file->priv->mount_operation_factory = callback; file->priv->mount_operation_userdata = user_data; file->priv->mount_operation_notify = notify; } GMountOperation * _tepl_file_create_mount_operation (TeplFile *file) { if (file == NULL) { goto fallback; } g_return_val_if_fail (TEPL_IS_FILE (file), NULL); if (file->priv->mount_operation_factory != NULL) { return file->priv->mount_operation_factory (file, file->priv->mount_operation_userdata); } fallback: return g_mount_operation_new (); } /* Notify @file that its location has been mounted. */ void _tepl_file_set_mounted (TeplFile *file) { g_return_if_fail (TEPL_IS_FILE (file)); /* Querying the display-name should work now. */ update_short_name (file); } const gchar * _tepl_file_get_etag (TeplFile *file) { if (file == NULL) { return NULL; } g_return_val_if_fail (TEPL_IS_FILE (file), NULL); return file->priv->etag; } void _tepl_file_set_etag (TeplFile *file, const gchar *etag) { if (file == NULL) { return; } g_return_if_fail (TEPL_IS_FILE (file)); g_free (file->priv->etag); file->priv->etag = g_strdup (etag); } /** * tepl_file_add_uri_to_recent_manager: * @file: a #TeplFile. * * If the #TeplFile:location isn't %NULL, adds its URI to the default * #GtkRecentManager with gtk_recent_manager_add_item(). * * Since: 4.0 */ /* In the future a vfunc could be added for this function if it is desirable to * customize it in an application. */ void tepl_file_add_uri_to_recent_manager (TeplFile *file) { GtkRecentManager *recent_manager; gchar *uri; g_return_if_fail (TEPL_IS_FILE (file)); if (file->priv->location == NULL) { return; } recent_manager = gtk_recent_manager_get_default (); uri = g_file_get_uri (file->priv->location); gtk_recent_manager_add_item (recent_manager, uri); g_free (uri); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-file.h000066400000000000000000000064751526404732400252260ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2014-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_FILE_H #define TEPL_FILE_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_FILE (tepl_file_get_type ()) #define TEPL_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_FILE, TeplFile)) #define TEPL_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_FILE, TeplFileClass)) #define TEPL_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_FILE)) #define TEPL_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_FILE)) #define TEPL_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_FILE, TeplFileClass)) typedef struct _TeplFile TeplFile; typedef struct _TeplFileClass TeplFileClass; typedef struct _TeplFilePrivate TeplFilePrivate; struct _TeplFile { GObject parent; TeplFilePrivate *priv; }; struct _TeplFileClass { GObjectClass parent_class; gpointer padding[12]; }; /** * TeplMountOperationFactory: * @file: a #TeplFile. * @user_data: user data. * * Type definition for a function that will be called to create a * #GMountOperation. This is useful for creating a #GtkMountOperation. * * Since: 1.0 */ typedef GMountOperation *(*TeplMountOperationFactory) (TeplFile *file, gpointer user_data); /** * TeplNewlineType: * @TEPL_NEWLINE_TYPE_LF: line feed, used on UNIX. * @TEPL_NEWLINE_TYPE_CR: carriage return, used on Mac. * @TEPL_NEWLINE_TYPE_CR_LF: carriage return followed by a line feed, used * on Windows. * * Since: 1.0 */ typedef enum { TEPL_NEWLINE_TYPE_LF, TEPL_NEWLINE_TYPE_CR, TEPL_NEWLINE_TYPE_CR_LF } TeplNewlineType; /** * TEPL_NEWLINE_TYPE_DEFAULT: * * The default newline type on the current OS. * * Since: 1.0 */ #ifdef G_OS_WIN32 #define TEPL_NEWLINE_TYPE_DEFAULT TEPL_NEWLINE_TYPE_CR_LF #else #define TEPL_NEWLINE_TYPE_DEFAULT TEPL_NEWLINE_TYPE_LF #endif G_MODULE_EXPORT GType tepl_file_get_type (void); G_MODULE_EXPORT TeplFile * tepl_file_new (void); G_MODULE_EXPORT GFile * tepl_file_get_location (TeplFile *file); G_MODULE_EXPORT void tepl_file_set_location (TeplFile *file, GFile *location); G_MODULE_EXPORT gchar * tepl_file_get_short_name (TeplFile *file); G_MODULE_EXPORT gchar * tepl_file_get_full_name (TeplFile *file); G_MODULE_EXPORT TeplNewlineType tepl_file_get_newline_type (TeplFile *file); G_MODULE_EXPORT void tepl_file_set_mount_operation_factory (TeplFile *file, TeplMountOperationFactory callback, gpointer user_data, GDestroyNotify notify); G_MODULE_EXPORT void tepl_file_add_uri_to_recent_manager (TeplFile *file); G_GNUC_INTERNAL void _tepl_file_set_newline_type (TeplFile *file, TeplNewlineType newline_type); G_GNUC_INTERNAL GMountOperation * _tepl_file_create_mount_operation (TeplFile *file); G_GNUC_INTERNAL void _tepl_file_set_mounted (TeplFile *file); G_GNUC_INTERNAL const gchar * _tepl_file_get_etag (TeplFile *file); G_GNUC_INTERNAL void _tepl_file_set_etag (TeplFile *file, const gchar *etag); G_END_DECLS #endif /* TEPL_FILE_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-fold-region.c000066400000000000000000000241361526404732400265010ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-fold-region.h" /** * SECTION:fold-region * @Short_description: Foldable region in a #GtkTextBuffer * @Title: TeplFoldRegion * * #TeplFoldRegion represents a region in a #GtkTextBuffer that can be folded. * * When a region is being folded, a #GtkTextTag with the #GtkTextTag:invisible * property is applied to the folded region. The actual start and end position * of this #GtkTextTag is respectively at the next new line after the start and * end position of the bounds handed over to tepl_fold_region_set_bounds(). */ enum { PROP_0, PROP_BUFFER, PROP_FOLDED, N_PROPERTIES }; typedef struct _TeplFoldRegionPrivate TeplFoldRegionPrivate; struct _TeplFoldRegionPrivate { GtkTextBuffer *buffer; /* A reference to the tag table where the tag is added. The sole * purpose is to remove the tag in dispose(). We can not rely on * 'buffer' since it is a weak reference. */ GtkTextTagTable *tag_table; GtkTextTag *tag; GtkTextMark *start_mark; GtkTextMark *end_mark; }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplFoldRegion, tepl_fold_region, G_TYPE_OBJECT) static void apply_tag (TeplFoldRegion *fold_region) { TeplFoldRegionPrivate *priv = tepl_fold_region_get_instance_private (fold_region); GtkTextIter start_iter; GtkTextIter end_iter; g_assert (priv->tag == NULL); g_assert (priv->tag_table == NULL); g_assert (priv->start_mark != NULL); g_assert (priv->end_mark != NULL); g_assert (priv->buffer != NULL); priv->tag = gtk_text_buffer_create_tag (priv->buffer, NULL, "invisible", TRUE, NULL); priv->tag_table = gtk_text_buffer_get_tag_table (priv->buffer); g_object_ref (priv->tag); g_object_ref (priv->tag_table); gtk_text_buffer_get_iter_at_mark (priv->buffer, &start_iter, priv->start_mark); gtk_text_buffer_get_iter_at_mark (priv->buffer, &end_iter, priv->end_mark); gtk_text_iter_forward_line (&start_iter); gtk_text_iter_forward_line (&end_iter); gtk_text_buffer_apply_tag (priv->buffer, priv->tag, &start_iter, &end_iter); } static void destroy_tag (TeplFoldRegion *fold_region) { TeplFoldRegionPrivate *priv = tepl_fold_region_get_instance_private (fold_region); gtk_text_tag_table_remove (priv->tag_table, priv->tag); g_clear_object (&priv->tag); g_clear_object (&priv->tag_table); } static void tepl_fold_region_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplFoldRegion *fold_region = TEPL_FOLD_REGION (object); switch (prop_id) { case PROP_BUFFER: g_value_set_object (value, tepl_fold_region_get_buffer (fold_region)); break; case PROP_FOLDED: g_value_set_boolean (value, tepl_fold_region_get_folded (fold_region)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_fold_region_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplFoldRegion *fold_region = TEPL_FOLD_REGION (object); TeplFoldRegionPrivate *priv = tepl_fold_region_get_instance_private (fold_region); switch (prop_id) { case PROP_BUFFER: g_assert (priv->buffer == NULL); g_set_weak_pointer (&priv->buffer, g_value_get_object (value)); break; case PROP_FOLDED: tepl_fold_region_set_folded (fold_region, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_fold_region_dispose (GObject *object) { TeplFoldRegion *fold_region = TEPL_FOLD_REGION (object); TeplFoldRegionPrivate *priv = tepl_fold_region_get_instance_private (fold_region); if (priv->tag != NULL && priv->tag_table != NULL) { gtk_text_tag_table_remove (priv->tag_table, priv->tag); g_clear_object (&priv->tag); g_clear_object (&priv->tag_table); } if (priv->buffer != NULL) { if (priv->start_mark != NULL) { gtk_text_buffer_delete_mark (priv->buffer, priv->start_mark); priv->start_mark = NULL; } if (priv->end_mark != NULL) { gtk_text_buffer_delete_mark (priv->buffer, priv->end_mark); priv->end_mark = NULL; } g_clear_weak_pointer (&priv->buffer); } priv->start_mark = NULL; priv->end_mark = NULL; G_OBJECT_CLASS (tepl_fold_region_parent_class)->dispose (object); } static void tepl_fold_region_class_init (TeplFoldRegionClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_fold_region_get_property; object_class->set_property = tepl_fold_region_set_property; object_class->dispose = tepl_fold_region_dispose; /** * TeplFoldRegion:buffer: * * The #GtkTextBuffer where the fold region is applied. The * #TeplFoldRegion object has a weak reference to the buffer. * * Since: 1.0 */ properties[PROP_BUFFER] = g_param_spec_object ("buffer", "Text Buffer", "", GTK_TYPE_TEXT_BUFFER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplFoldRegion:folded: * * Whether the #TeplFoldRegion is folded or not. * * Since: 1.0 */ properties[PROP_FOLDED] = g_param_spec_boolean ("folded", "Folded", "", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_fold_region_init (TeplFoldRegion *fold_region) { } /** * tepl_fold_region_new: * @buffer: a #GtkTextBuffer. * @start: a #GtkTextIter. * @end: a #GtkTextIter. * * Returns: a new #TeplFoldRegion. * Since: 1.0 */ TeplFoldRegion * tepl_fold_region_new (GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end) { TeplFoldRegion *fold_region; g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL); g_return_val_if_fail (start != NULL, NULL); g_return_val_if_fail (end != NULL, NULL); fold_region = g_object_new (TEPL_TYPE_FOLD_REGION, "buffer", buffer, NULL); tepl_fold_region_set_bounds (fold_region, start, end); return fold_region; } /** * tepl_fold_region_get_buffer: * @fold_region: a #TeplFoldRegion. * * Returns: (transfer none) (nullable): the #GtkTextBuffer where the fold region * is applied. * Since: 1.0 */ GtkTextBuffer * tepl_fold_region_get_buffer (TeplFoldRegion *fold_region) { TeplFoldRegionPrivate *priv; g_return_val_if_fail (TEPL_IS_FOLD_REGION (fold_region), NULL); priv = tepl_fold_region_get_instance_private (fold_region); return priv->buffer; } /** * tepl_fold_region_get_folded: * @fold_region: a #TeplFoldRegion. * * Returns: whether the #TeplFoldRegion is folded. * Since: 1.0 */ gboolean tepl_fold_region_get_folded (TeplFoldRegion *fold_region) { TeplFoldRegionPrivate *priv; g_return_val_if_fail (TEPL_IS_FOLD_REGION (fold_region), FALSE); priv = tepl_fold_region_get_instance_private (fold_region); return priv->tag != NULL; } /** * tepl_fold_region_set_folded: * @fold_region: a #TeplFoldRegion. * @folded: the new value. * * Folds or unfolds the region. * * Since: 1.0 */ void tepl_fold_region_set_folded (TeplFoldRegion *fold_region, gboolean folded) { TeplFoldRegionPrivate *priv; g_return_if_fail (TEPL_IS_FOLD_REGION (fold_region)); priv = tepl_fold_region_get_instance_private (fold_region); if (priv->buffer == NULL) { return; } if (priv->start_mark == NULL || priv->end_mark == NULL) { return; } folded = folded != FALSE; if (folded == tepl_fold_region_get_folded (fold_region)) { return; } if (folded) { apply_tag (fold_region); } else { destroy_tag (fold_region); } g_object_notify_by_pspec (G_OBJECT (fold_region), properties[PROP_FOLDED]); } /** * tepl_fold_region_get_bounds: * @fold_region: a #TeplFoldRegion. * @start: (out): iterator to initialize. * @end: (out): iterator to initialize. * * Obtains iterators pointing to the start and end of the #TeplFoldRegion. * * Returns: %TRUE on success, %FALSE otherwise. * Since: 1.0 */ gboolean tepl_fold_region_get_bounds (TeplFoldRegion *fold_region, GtkTextIter *start, GtkTextIter *end) { TeplFoldRegionPrivate *priv; g_return_val_if_fail (TEPL_IS_FOLD_REGION (fold_region), FALSE); g_return_val_if_fail (start != NULL, FALSE); g_return_val_if_fail (end != NULL, FALSE); priv = tepl_fold_region_get_instance_private (fold_region); if (priv->buffer == NULL) { return FALSE; } if (priv->start_mark == NULL || priv->end_mark == NULL) { return FALSE; } gtk_text_buffer_get_iter_at_mark (priv->buffer, start, priv->start_mark); gtk_text_buffer_get_iter_at_mark (priv->buffer, end, priv->end_mark); return TRUE; } /** * tepl_fold_region_set_bounds: * @fold_region: a #TeplFoldRegion. * @start: a #GtkTextIter. * @end: a #GtkTextIter. * * Sets the start and end of the #TeplFoldRegion. * * Since: 1.0 */ void tepl_fold_region_set_bounds (TeplFoldRegion *fold_region, const GtkTextIter *start, const GtkTextIter *end) { TeplFoldRegionPrivate *priv; g_return_if_fail (TEPL_IS_FOLD_REGION (fold_region)); g_return_if_fail (start != NULL); g_return_if_fail (end != NULL); g_return_if_fail (gtk_text_iter_get_line (start) < gtk_text_iter_get_line (end)); priv = tepl_fold_region_get_instance_private (fold_region); if (priv->buffer == NULL) { return; } if (priv->start_mark != NULL) { gtk_text_buffer_move_mark (priv->buffer, priv->start_mark, start); } else { priv->start_mark = gtk_text_buffer_create_mark (priv->buffer, NULL, start, TRUE); } if (priv->end_mark != NULL) { gtk_text_buffer_move_mark (priv->buffer, priv->end_mark, end); } else { priv->end_mark = gtk_text_buffer_create_mark (priv->buffer, NULL, end, FALSE); } if (priv->tag != NULL && priv->tag_table != NULL) { destroy_tag (fold_region); apply_tag (fold_region); } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-fold-region.h000066400000000000000000000025711526404732400265050ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_FOLD_REGION_H #define TEPL_FOLD_REGION_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_FOLD_REGION (tepl_fold_region_get_type ()) G_MODULE_EXPORT G_DECLARE_DERIVABLE_TYPE (TeplFoldRegion, tepl_fold_region, TEPL, FOLD_REGION, GObject) struct _TeplFoldRegionClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT TeplFoldRegion * tepl_fold_region_new (GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end); G_MODULE_EXPORT GtkTextBuffer * tepl_fold_region_get_buffer (TeplFoldRegion *fold_region); G_MODULE_EXPORT gboolean tepl_fold_region_get_folded (TeplFoldRegion *fold_region); G_MODULE_EXPORT void tepl_fold_region_set_folded (TeplFoldRegion *fold_region, gboolean folded); G_MODULE_EXPORT gboolean tepl_fold_region_get_bounds (TeplFoldRegion *fold_region, GtkTextIter *start, GtkTextIter *end); G_MODULE_EXPORT void tepl_fold_region_set_bounds (TeplFoldRegion *fold_region, const GtkTextIter *start, const GtkTextIter *end); G_END_DECLS #endif /* TEPL_FOLD_REGION_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-goto-line-bar.c000066400000000000000000000176741526404732400267440ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-goto-line-bar.h" #include #include "tepl-utils.h" /** * SECTION:goto-line-bar * @Title: TeplGotoLineBar * @Short_description: Horizontal bar for the 'Go to line' feature * * #TeplGotoLineBar is an horizontal bar containing among other things: * - A #GtkSearchEntry. * - A close button. * * When the #GtkSearchEntry's content changes, tepl_view_goto_line() is called * on the associated #TeplView. * * # High-level API * * #TeplGotoLineBar is integrated in the Tepl framework, see: * - The `"win.tepl-goto-line"` #GAction in #TeplApplicationWindow. * - The tepl_tab_get_goto_line_bar() function. */ struct _TeplGotoLineBarPrivate { /* A GtkSearchEntry. */ GtkEntry *entry; /* Owns a strong ref. */ TeplView *view; guint bound_to_gaction_state : 1; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplGotoLineBar, tepl_goto_line_bar, GTK_TYPE_GRID) static void tepl_goto_line_bar_dispose (GObject *object) { TeplGotoLineBar *bar = TEPL_GOTO_LINE_BAR (object); bar->priv->entry = NULL; g_clear_object (&bar->priv->view); G_OBJECT_CLASS (tepl_goto_line_bar_parent_class)->dispose (object); } static void tepl_goto_line_bar_class_init (TeplGotoLineBarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_goto_line_bar_dispose; gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "TeplGotoLineBar"); } static void hide_bar_by_explicit_user_action (TeplGotoLineBar *bar) { gtk_widget_hide (GTK_WIDGET (bar)); if (bar->priv->view != NULL) { gtk_widget_grab_focus (GTK_WIDGET (bar->priv->view)); } } static void set_success (GtkEntry *entry, gboolean success) { GtkStyleContext *style_context; style_context = gtk_widget_get_style_context (GTK_WIDGET (entry)); if (success) { gtk_style_context_remove_class (style_context, GTK_STYLE_CLASS_ERROR); } else { gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_ERROR); } } static void entry_search_changed_cb (GtkEntry *entry, TeplGotoLineBar *bar) { const gchar *entry_text; gint64 line = 0; gboolean success = FALSE; if (bar->priv->view == NULL) { return; } entry_text = gtk_entry_get_text (entry); if (entry_text == NULL || entry_text[0] == '\0') { set_success (entry, TRUE); return; } if (g_ascii_string_to_signed (entry_text, 10, 0, G_MAXINT, &line, NULL)) { /* When typing "0" in the search entry, treat it the same as 1. */ success = tepl_view_goto_line (bar->priv->view, MAX (line - 1, 0)); } set_success (entry, success); } static void entry_activate_cb (GtkEntry *entry, TeplGotoLineBar *bar) { hide_bar_by_explicit_user_action (bar); } static void create_entry (TeplGotoLineBar *bar) { g_assert (bar->priv->entry == NULL); bar->priv->entry = GTK_ENTRY (gtk_search_entry_new ()); gtk_widget_show (GTK_WIDGET (bar->priv->entry)); gtk_grid_attach (GTK_GRID (bar), GTK_WIDGET (bar->priv->entry), 1, 0, 1, 1); g_signal_connect (bar->priv->entry, "search-changed", G_CALLBACK (entry_search_changed_cb), bar); g_signal_connect (bar->priv->entry, "activate", G_CALLBACK (entry_activate_cb), bar); } static void close_button_clicked_cb (GtkButton *close_button, TeplGotoLineBar *bar) { hide_bar_by_explicit_user_action (bar); } static void bar_hide_cb (TeplGotoLineBar *bar, gpointer user_data) { /* A previous implementation for this callback was: * gtk_entry_set_text (bar->priv->entry, ""); * * But there was the following situation that was not working well wrt * the styling applied to the GtkEntry: * * GtkEntry in error state (see set_success()) -> hide bar -> set entry * text to "" -> the entry state is set to success but the bar is * immediately hidden -> then some time later the bar is shown again. * --> the error state (in red) is still visible during a short period * of time when the bar is shown again. The time that it transitions to * the normal state (the colors fade progressively). * * I haven't found a GtkStyleContext API to fix that problem (for * example to apply the final state immediately). * * So the easiest is to destroy and re-create the widget. That way when * it will be shown again, we are sure that it will have the initial * style. */ if (bar->priv->entry != NULL) { gtk_widget_destroy (GTK_WIDGET (bar->priv->entry)); bar->priv->entry = NULL; } create_entry (bar); } static void apply_style (TeplGotoLineBar *bar) { GtkStyleContext *style_context; const gchar *css; GtkCssProvider *css_provider; style_context = gtk_widget_get_style_context (GTK_WIDGET (bar)); gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_FRAME); css = "TeplGotoLineBar {\n" " padding-left: 6px;\n" " padding-right: 4px;\n" " padding-top: 3px;\n" " padding-bottom: 3px;\n" "\n" " border-bottom: none;\n" " border-left: none;\n" " border-right: none;\n" "}\n"; css_provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (css_provider, css, -1, NULL); gtk_style_context_add_provider (style_context, GTK_STYLE_PROVIDER (css_provider), TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY); g_object_unref (css_provider); } static void tepl_goto_line_bar_init (TeplGotoLineBar *bar) { GtkWidget *label; GtkWidget *close_button; bar->priv = tepl_goto_line_bar_get_instance_private (bar); apply_style (bar); gtk_grid_set_column_spacing (GTK_GRID (bar), 6); label = gtk_label_new (_("Go to line:")); gtk_widget_show (label); gtk_grid_attach (GTK_GRID (bar), label, 0, 0, 1, 1); create_entry (bar); close_button = tepl_utils_create_close_button (); gtk_widget_show (close_button); gtk_widget_set_tooltip_text (close_button, _("Close")); gtk_widget_set_hexpand (close_button, TRUE); gtk_widget_set_halign (close_button, GTK_ALIGN_END); gtk_grid_attach (GTK_GRID (bar), close_button, 2, 0, 1, 1); g_signal_connect (close_button, "clicked", G_CALLBACK (close_button_clicked_cb), bar); g_signal_connect (bar, "hide", G_CALLBACK (bar_hide_cb), NULL); } /** * tepl_goto_line_bar_new: * * Returns: (transfer floating): a new #TeplGotoLineBar widget. * Since: 5.0 */ TeplGotoLineBar * tepl_goto_line_bar_new (void) { return g_object_new (TEPL_TYPE_GOTO_LINE_BAR, NULL); } /** * tepl_goto_line_bar_set_view: * @bar: a #TeplGotoLineBar. * @view: a #TeplView. * * Sets the #TeplView. tepl_view_goto_line() will be called on @view when the * user types a line number in the #GtkSearchEntry of @bar. * * Only one #TeplView can be associated per #TeplGotoLineBar. * * Since: 5.0 */ void tepl_goto_line_bar_set_view (TeplGotoLineBar *bar, TeplView *view) { g_return_if_fail (TEPL_IS_GOTO_LINE_BAR (bar)); g_return_if_fail (view == NULL || TEPL_IS_VIEW (view)); if (bar->priv->view != view) { g_clear_object (&bar->priv->view); bar->priv->view = g_object_ref_sink (view); } } /** * tepl_goto_line_bar_grab_focus_to_entry: * @bar: a #TeplGotoLineBar. * * Calls gtk_widget_grab_focus() to the #GtkSearchEntry of @bar. * * Since: 5.0 */ void tepl_goto_line_bar_grab_focus_to_entry (TeplGotoLineBar *bar) { g_return_if_fail (TEPL_IS_GOTO_LINE_BAR (bar)); gtk_widget_grab_focus (GTK_WIDGET (bar->priv->entry)); } void _tepl_goto_line_bar_bind_to_gaction_state (TeplGotoLineBar *bar, GAction *action) { g_return_if_fail (TEPL_IS_GOTO_LINE_BAR (bar)); g_return_if_fail (G_IS_ACTION (action)); if (!bar->priv->bound_to_gaction_state) { g_object_bind_property_full (action, "state", bar, "visible", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, tepl_utils_binding_transform_func_smart_bool, tepl_utils_binding_transform_func_smart_bool, NULL, NULL); bar->priv->bound_to_gaction_state = TRUE; } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-goto-line-bar.h000066400000000000000000000035401526404732400267340ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_GOTO_LINE_BAR_H #define TEPL_GOTO_LINE_BAR_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS #define TEPL_TYPE_GOTO_LINE_BAR (tepl_goto_line_bar_get_type ()) #define TEPL_GOTO_LINE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_GOTO_LINE_BAR, TeplGotoLineBar)) #define TEPL_GOTO_LINE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_GOTO_LINE_BAR, TeplGotoLineBarClass)) #define TEPL_IS_GOTO_LINE_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_GOTO_LINE_BAR)) #define TEPL_IS_GOTO_LINE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_GOTO_LINE_BAR)) #define TEPL_GOTO_LINE_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_GOTO_LINE_BAR, TeplGotoLineBarClass)) typedef struct _TeplGotoLineBar TeplGotoLineBar; typedef struct _TeplGotoLineBarClass TeplGotoLineBarClass; typedef struct _TeplGotoLineBarPrivate TeplGotoLineBarPrivate; struct _TeplGotoLineBar { GtkGrid parent; TeplGotoLineBarPrivate *priv; }; struct _TeplGotoLineBarClass { GtkGridClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_goto_line_bar_get_type (void); G_MODULE_EXPORT TeplGotoLineBar * tepl_goto_line_bar_new (void); G_MODULE_EXPORT void tepl_goto_line_bar_set_view (TeplGotoLineBar *bar, TeplView *view); G_MODULE_EXPORT void tepl_goto_line_bar_grab_focus_to_entry (TeplGotoLineBar *bar); G_GNUC_INTERNAL void _tepl_goto_line_bar_bind_to_gaction_state (TeplGotoLineBar *bar, GAction *action); G_END_DECLS #endif /* TEPL_GOTO_LINE_BAR_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-gutter-renderer-folds.c000066400000000000000000000170721526404732400305200ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2013, 2016 - Sébastien Wilmet * SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-gutter-renderer-folds.h" /** * SECTION:gutter-renderer-folds * @Short_description: Basic gutter renderer for code folding * @Title: TeplGutterRendererFolds * * #TeplGutterRendererFolds is a basic gutter renderer for code folding. It * handles only the drawing, and has a flat view of the folding tree. */ /* The square size for drawing the box around the minus and plus signs. To be * able to draw the sign in the middle of the square, the square size must be an * odd number, since the line width is 1.0. */ #define SQUARE_SIZE 9 typedef struct _TeplGutterRendererFoldsPrivate TeplGutterRendererFoldsPrivate; struct _TeplGutterRendererFoldsPrivate { TeplGutterRendererFoldsState folding_state; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplGutterRendererFolds, tepl_gutter_renderer_folds, GTK_SOURCE_TYPE_GUTTER_RENDERER) /* Draw a minus or a plus surrounded by a square. */ static void draw_sign (cairo_t *cr, GdkRectangle *cell_area, gboolean folded) { gint sign_width = SQUARE_SIZE - 4; gint left_margin; gint top_margin; gint x; gint y; /* Integer division */ left_margin = (cell_area->width - SQUARE_SIZE) / 2; top_margin = (cell_area->height - SQUARE_SIZE) / 2; x = cell_area->x + left_margin; y = cell_area->y + top_margin; cairo_rectangle (cr, x + 0.5, y + 0.5, SQUARE_SIZE - 1.0, SQUARE_SIZE - 1.0); cairo_move_to (cr, x + 2.5, y + SQUARE_SIZE / 2.0); cairo_rel_line_to (cr, sign_width - 1.0, 0); if (folded) { cairo_move_to (cr, x + SQUARE_SIZE / 2.0, y + 2.5); cairo_rel_line_to (cr, 0, sign_width - 1.0); } } static void draw_vertical_line (cairo_t *cr, GdkRectangle *cell_area) { /* Integer division */ gint x = cell_area->x + cell_area->width / 2; cairo_move_to (cr, x + 0.5, cell_area->y + 0.5); cairo_rel_line_to (cr, 0, cell_area->height - 1.0); } static void draw_end (cairo_t *cr, GdkRectangle *cell_area) { /* Integer division */ gint x = cell_area->x + cell_area->width / 2; gint height = cell_area->height / 2 + 1; cairo_move_to (cr, x + 0.5, cell_area->y + 0.5); cairo_rel_line_to (cr, 0, height - 1.0); cairo_line_to (cr, cell_area->x + cell_area->width - 0.5, cell_area->y + height - 0.5); } /* To draw the folding states (that can be combined), the cell_area is split in * three parts. The middle_area can contain the minus or plus sign, surrounded * by a square. It can also contain a vertical bar, or a small horizontal bar to * mark a fold end, etc. The top_area and bottom_area can just contain a * vertical bar. * * Returns: %TRUE on success, %FALSE if the @cell_area is too small. */ static gboolean split_cell_area (const GdkRectangle *cell_area, GdkRectangle *top_area, GdkRectangle *middle_area, GdkRectangle *bottom_area) { if (cell_area->height < SQUARE_SIZE || cell_area->width < SQUARE_SIZE) { return FALSE; } top_area->x = cell_area->x; top_area->y = cell_area->y; top_area->width = cell_area->width; top_area->height = (cell_area->height - SQUARE_SIZE) / 2; middle_area->x = cell_area->x; middle_area->y = top_area->y + top_area->height; middle_area->width = cell_area->width; middle_area->height = SQUARE_SIZE; bottom_area->x = cell_area->x; bottom_area->y = middle_area->y + middle_area->height; bottom_area->width = cell_area->width; bottom_area->height = cell_area->height - top_area->height - middle_area->height; return TRUE; } static void tepl_gutter_renderer_folds_draw (GtkSourceGutterRenderer *renderer, cairo_t *cr, GdkRectangle *background_area, GdkRectangle *cell_area, GtkTextIter *start, GtkTextIter *end, GtkSourceGutterRendererState state) { TeplGutterRendererFolds *self; TeplGutterRendererFoldsPrivate *priv; TeplGutterRendererFoldsState folding_state; GdkRectangle top_area; GdkRectangle middle_area; GdkRectangle bottom_area; self = TEPL_GUTTER_RENDERER_FOLDS (renderer); priv = tepl_gutter_renderer_folds_get_instance_private (self); /* Chain up to draw background */ if (GTK_SOURCE_GUTTER_RENDERER_CLASS (tepl_gutter_renderer_folds_parent_class)->draw != NULL) { GTK_SOURCE_GUTTER_RENDERER_CLASS (tepl_gutter_renderer_folds_parent_class)->draw (renderer, cr, background_area, cell_area, start, end, state); } if (!split_cell_area (cell_area, &top_area, &middle_area, &bottom_area)) { return; } cairo_save (cr); cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); cairo_set_line_width (cr, 1.0); folding_state = priv->folding_state; /* Top area */ if (folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE || folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_END) { draw_vertical_line (cr, &top_area); } /* Middle area */ if (folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_START_FOLDED) { draw_sign (cr, &middle_area, TRUE); } else if (folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_START_OPENED) { draw_sign (cr, &middle_area, FALSE); } else { if (folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE) { draw_vertical_line (cr, &middle_area); } if (folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_END) { draw_end (cr, &middle_area); } } /* Bottom area */ if (folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_START_OPENED || folding_state & TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE) { draw_vertical_line (cr, &bottom_area); } cairo_stroke (cr); cairo_restore (cr); } static void tepl_gutter_renderer_folds_constructed (GObject *object) { GtkSourceGutterRenderer *renderer = GTK_SOURCE_GUTTER_RENDERER (object); G_OBJECT_CLASS (tepl_gutter_renderer_folds_parent_class)->constructed (object); gtk_source_gutter_renderer_set_size (renderer, SQUARE_SIZE); gtk_source_gutter_renderer_set_padding (renderer, 2, -1); } static void tepl_gutter_renderer_folds_class_init (TeplGutterRendererFoldsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkSourceGutterRendererClass *renderer_class = GTK_SOURCE_GUTTER_RENDERER_CLASS (klass); object_class->constructed = tepl_gutter_renderer_folds_constructed; renderer_class->draw = tepl_gutter_renderer_folds_draw; } static void tepl_gutter_renderer_folds_init (TeplGutterRendererFolds *self) { } /** * tepl_gutter_renderer_folds_new: * * Returns: a new #TeplGutterRendererFolds. * Since: 1.0 */ GtkSourceGutterRenderer * tepl_gutter_renderer_folds_new (void) { return g_object_new (TEPL_TYPE_GUTTER_RENDERER_FOLDS, NULL); } /** * tepl_gutter_renderer_folds_set_state: * @self: a #TeplGutterRendererFolds. * @state: a #TeplGutterRendererFoldsState. * * Sets the folding state of the next cell to be drawn. * * This function is intended to be called from a subclass' draw method before * chaining-up to its parent's draw method. * * Since: 1.0 */ void tepl_gutter_renderer_folds_set_state (TeplGutterRendererFolds *self, TeplGutterRendererFoldsState state) { TeplGutterRendererFoldsPrivate *priv; g_return_if_fail (TEPL_IS_GUTTER_RENDERER_FOLDS (self)); priv = tepl_gutter_renderer_folds_get_instance_private (self); priv->folding_state = state; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-gutter-renderer-folds.h000066400000000000000000000041041526404732400305150ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2013, 2016 - Sébastien Wilmet * SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_GUTTER_RENDERER_FOLDS_H #define TEPL_GUTTER_RENDERER_FOLDS_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_GUTTER_RENDERER_FOLDS (tepl_gutter_renderer_folds_get_type ()) G_MODULE_EXPORT G_DECLARE_DERIVABLE_TYPE (TeplGutterRendererFolds, tepl_gutter_renderer_folds, TEPL, GUTTER_RENDERER_FOLDS, GtkSourceGutterRenderer) struct _TeplGutterRendererFoldsClass { GtkSourceGutterRendererClass parent_class; gpointer padding[12]; }; /** * TeplGutterRendererFoldsState: * @TEPL_GUTTER_RENDERER_FOLDS_STATE_NONE: No code folding here. * @TEPL_GUTTER_RENDERER_FOLDS_STATE_START_FOLDED: Start of currently folded * fold region. * @TEPL_GUTTER_RENDERER_FOLDS_STATE_START_OPENED: Start of currently opened * fold region. * @TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE: Fold region continues. * @TEPL_GUTTER_RENDERER_FOLDS_STATE_END: End of fold region. * * The folding state at a certain line in the #GtkTextBuffer. * * Since #TeplGutterRendererFolds has a flat view of the folding tree, some * states can be combined; for example, %TEPL_GUTTER_RENDERER_FOLDS_STATE_END * and %TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE. * * Since: 1.0 */ typedef enum { TEPL_GUTTER_RENDERER_FOLDS_STATE_NONE = 0, TEPL_GUTTER_RENDERER_FOLDS_STATE_START_FOLDED = 1 << 0, TEPL_GUTTER_RENDERER_FOLDS_STATE_START_OPENED = 1 << 1, TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE = 1 << 2, TEPL_GUTTER_RENDERER_FOLDS_STATE_END = 1 << 3 } TeplGutterRendererFoldsState; G_MODULE_EXPORT GtkSourceGutterRenderer * tepl_gutter_renderer_folds_new (void); G_MODULE_EXPORT void tepl_gutter_renderer_folds_set_state (TeplGutterRendererFolds *self, TeplGutterRendererFoldsState state); G_END_DECLS #endif /* TEPL_GUTTER_RENDERER_FOLDS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-icu.c000066400000000000000000000132071526404732400250510ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-icu.h" /* Wrapper around u_strFromUTF8() that handles the pre-flighting. * * Returns: (transfer full) (nullable): the newly-allocated buffer with the * right size. Free with g_free() when no longer needed. */ UChar * _tepl_icu_strFromUTF8 (int32_t *pDestLength, const char *src, int32_t srcLength, UErrorCode *pErrorCode) { int32_t my_DestLength = 0; UErrorCode my_ErrorCode = U_ZERO_ERROR; UChar *dest = NULL; u_strFromUTF8 (NULL, 0, &my_DestLength, src, srcLength, &my_ErrorCode); if (my_ErrorCode != U_BUFFER_OVERFLOW_ERROR && my_ErrorCode != U_STRING_NOT_TERMINATED_WARNING) { if (pDestLength != NULL) { *pDestLength = my_DestLength; } if (pErrorCode != NULL) { *pErrorCode = my_ErrorCode; } return NULL; } dest = g_new0 (UChar, my_DestLength + 1); u_strFromUTF8 (dest, my_DestLength + 1, pDestLength, src, srcLength, pErrorCode); return dest; } /* Wrapper around u_strToUTF8() that handles the pre-flighting. * * Returns: (transfer full) (nullable): the newly-allocated string with the * right size. Free with g_free() when no longer needed. */ char * _tepl_icu_strToUTF8 (int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode) { int32_t my_DestLength = 0; UErrorCode my_ErrorCode = U_ZERO_ERROR; char *dest = NULL; u_strToUTF8 (NULL, 0, &my_DestLength, src, srcLength, &my_ErrorCode); if (my_ErrorCode != U_BUFFER_OVERFLOW_ERROR && my_ErrorCode != U_STRING_NOT_TERMINATED_WARNING) { if (pDestLength != NULL) { *pDestLength = my_DestLength; } if (pErrorCode != NULL) { *pErrorCode = my_ErrorCode; } return NULL; } dest = g_malloc0 (my_DestLength + 1); u_strToUTF8 (dest, my_DestLength + 1, pDestLength, src, srcLength, pErrorCode); return dest; } /* Returns: (transfer full) (nullable): a nul-terminated UTF-16 string. Free * with g_free() when no longer needed. */ UChar * _tepl_icu_strFromUTF8Simple (const char *utf8_str) { UChar *uchars; UErrorCode error_code = U_ZERO_ERROR; uchars = _tepl_icu_strFromUTF8 (NULL, utf8_str, -1, &error_code); if (U_FAILURE (error_code)) { g_free (uchars); return NULL; } return uchars; } /* Returns: (transfer full) (nullable): a nul-terminated UTF-8 string. Free with * g_free() when no longer needed. */ char * _tepl_icu_strToUTF8Simple (const UChar *uchars) { char *utf8_str; UErrorCode error_code = U_ZERO_ERROR; utf8_str = _tepl_icu_strToUTF8 (NULL, uchars, -1, &error_code); if (U_FAILURE (error_code)) { g_free (utf8_str); return NULL; } return utf8_str; } /* Returns: (transfer full) (nullable): a copy of @uchars. Free with g_free() * when no longer needed. */ UChar * _tepl_icu_strdup (const UChar *uchars) { int32_t length; UChar *copy; if (uchars == NULL) { return NULL; } length = u_strlen (uchars); copy = g_new0 (UChar, length + 1); return u_strncpy (copy, uchars, length + 1); } /* A wrapper around utrans_openU(). */ UTransliterator * _tepl_icu_trans_openUSimple (const char *utf8_id) { UChar *id; UTransliterator *transliterator; UErrorCode error_code = U_ZERO_ERROR; id = _tepl_icu_strFromUTF8Simple (utf8_id); g_return_val_if_fail (id != NULL, NULL); transliterator = utrans_openU (id, -1, UTRANS_FORWARD, NULL, 0, NULL, &error_code); g_free (id); if (U_FAILURE (error_code)) { g_warn_if_reached (); if (transliterator != NULL) { utrans_close (transliterator); } return NULL; } return transliterator; } UTransliterator * _tepl_icu_trans_open_xml_escape (void) { /* Don't escape all the characters, keep certain printable ASCII * characters as is. That way it's a bit easier to understand when * reading/debugging the XML content. * * The ICU transliterator/transform can be tested easily with the uconv * command, including a round-trip: * $ echo -n -e '\t' | uconv -x '[^a-zA-Z0-9.,;/_\x2D\x3A] Any-Hex/XML' | uconv -x 'Hex-Any/XML' * * "\\x2D" is '-' and "\\x3A" is ':'. */ return _tepl_icu_trans_openUSimple ("[^a-zA-Z0-9.,;/_\\x2D\\x3A] Any-Hex/XML"); } /* Like utrans_transUChars(), but simpler to use. * @src must be nul-terminated, and is not modified. * * Returns: (transfer full) (nullable): the transformed string, as a * newly-allocated nul-terminated buffer of the right size. Free with g_free() * when no longer needed. */ UChar * _tepl_icu_trans_transUCharsSimple (const UTransliterator *trans, const UChar *src) { UChar *src_copy; int32_t src_length; int32_t text_length; int32_t limit; int32_t dest_capacity; UChar *dest; UErrorCode error_code = U_ZERO_ERROR; /* Pre-flighting */ src_copy = _tepl_icu_strdup (src); src_length = u_strlen (src); text_length = src_length; limit = src_length; utrans_transUChars (trans, src_copy, &text_length, src_length + 1, 0, &limit, &error_code); g_free (src_copy); if (error_code != U_BUFFER_OVERFLOW_ERROR && error_code != U_STRING_NOT_TERMINATED_WARNING && U_FAILURE (error_code)) { g_warn_if_reached (); return NULL; } /* Do the real transform */ dest_capacity = MAX (text_length + 1, src_length + 1); dest = g_new0 (UChar, dest_capacity); u_strncpy (dest, src, src_length + 1); limit = src_length; error_code = U_ZERO_ERROR; utrans_transUChars (trans, dest, NULL, dest_capacity, 0, &limit, &error_code); if (U_FAILURE (error_code)) { g_warn_if_reached (); g_free (dest); return NULL; } return dest; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-icu.h000066400000000000000000000021731526404732400250560ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_ICU_H #define TEPL_ICU_H #include #include #include G_BEGIN_DECLS G_GNUC_INTERNAL UChar * _tepl_icu_strFromUTF8 (int32_t *pDestLength, const char *src, int32_t srcLength, UErrorCode *pErrorCode); G_GNUC_INTERNAL char * _tepl_icu_strToUTF8 (int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); G_GNUC_INTERNAL UChar * _tepl_icu_strFromUTF8Simple (const char *utf8_str); G_GNUC_INTERNAL char * _tepl_icu_strToUTF8Simple (const UChar *uchars); G_GNUC_INTERNAL UChar * _tepl_icu_strdup (const UChar *uchars); G_GNUC_INTERNAL UTransliterator * _tepl_icu_trans_openUSimple (const char *utf8_id); G_GNUC_INTERNAL UTransliterator * _tepl_icu_trans_open_xml_escape (void); G_GNUC_INTERNAL UChar * _tepl_icu_trans_transUCharsSimple (const UTransliterator *trans, const UChar *src); G_END_DECLS #endif /* TEPL_ICU_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-info-bar.c000066400000000000000000000474051526404732400257750ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-info-bar.h" #include "tepl-utils.h" /** * SECTION:info-bar * @Title: TeplInfoBar * @Short_description: Subclass of #GtkInfoBar * * #TeplInfoBar is a subclass of #GtkInfoBar. In most cases it permits to create * #GtkInfoBar's more easily. * * The content area is divided into several sub-areas, described in * #TeplInfoBarLocation. */ struct _TeplInfoBarPrivate { GtkGrid *vgrid_main; GtkImage *icon; gchar *icon_name; GtkGrid *vgrid_alongside_icon; guint icon_from_message_type : 1; guint handle_close_response : 1; }; enum { PROP_0, PROP_ICON_FROM_MESSAGE_TYPE, PROP_ICON_NAME, PROP_HANDLE_CLOSE_RESPONSE, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplInfoBar, tepl_info_bar, GTK_TYPE_INFO_BAR) static void tepl_info_bar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplInfoBar *info_bar = TEPL_INFO_BAR (object); switch (prop_id) { case PROP_ICON_FROM_MESSAGE_TYPE: g_value_set_boolean (value, tepl_info_bar_get_icon_from_message_type (info_bar)); break; case PROP_ICON_NAME: g_value_set_string (value, tepl_info_bar_get_icon_name (info_bar)); break; case PROP_HANDLE_CLOSE_RESPONSE: g_value_set_boolean (value, tepl_info_bar_get_handle_close_response (info_bar)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_info_bar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplInfoBar *info_bar = TEPL_INFO_BAR (object); switch (prop_id) { case PROP_ICON_FROM_MESSAGE_TYPE: tepl_info_bar_set_icon_from_message_type (info_bar, g_value_get_boolean (value)); break; case PROP_ICON_NAME: tepl_info_bar_set_icon_name (info_bar, g_value_get_string (value)); break; case PROP_HANDLE_CLOSE_RESPONSE: tepl_info_bar_set_handle_close_response (info_bar, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_info_bar_dispose (GObject *object) { TeplInfoBar *info_bar = TEPL_INFO_BAR (object); info_bar->priv->vgrid_main = NULL; info_bar->priv->icon = NULL; info_bar->priv->vgrid_alongside_icon = NULL; G_OBJECT_CLASS (tepl_info_bar_parent_class)->dispose (object); } static void tepl_info_bar_finalize (GObject *object) { TeplInfoBar *info_bar = TEPL_INFO_BAR (object); g_free (info_bar->priv->icon_name); G_OBJECT_CLASS (tepl_info_bar_parent_class)->finalize (object); } static void tepl_info_bar_response (GtkInfoBar *gtk_info_bar, gint response_id) { TeplInfoBar *info_bar = TEPL_INFO_BAR (gtk_info_bar); if (response_id == GTK_RESPONSE_CLOSE && info_bar->priv->handle_close_response) { gtk_widget_destroy (GTK_WIDGET (info_bar)); /* No need to chain up, the widget is destroyed. */ return; } if (GTK_INFO_BAR_CLASS (tepl_info_bar_parent_class)->response != NULL) { GTK_INFO_BAR_CLASS (tepl_info_bar_parent_class)->response (gtk_info_bar, response_id); } } static void tepl_info_bar_class_init (TeplInfoBarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkInfoBarClass *info_bar_class = GTK_INFO_BAR_CLASS (klass); object_class->get_property = tepl_info_bar_get_property; object_class->set_property = tepl_info_bar_set_property; object_class->dispose = tepl_info_bar_dispose; object_class->finalize = tepl_info_bar_finalize; info_bar_class->response = tepl_info_bar_response; /** * TeplInfoBar:icon-from-message-type: * * If this property is %TRUE, then an icon is shown on the left, based * on the value of the #GtkInfoBar:message-type property. For * %GTK_MESSAGE_OTHER no icon is shown. * * If the #TeplInfoBar:icon-name property has a non-%NULL value, then * this property is not taken into account. * * Note that setting this property doesn't change the value of the * #TeplInfoBar:icon-name property; the two properties are separate. * * Since: 6.0 */ properties[PROP_ICON_FROM_MESSAGE_TYPE] = g_param_spec_boolean ("icon-from-message-type", "icon-from-message-type", "", FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); /** * TeplInfoBar:icon-name: * * If set to a non-%NULL value, then an icon is shown on the left. * * If this property has a non-%NULL value, then the * #TeplInfoBar:icon-from-message-type property is not taken into * account. * * Since: 6.0 */ properties[PROP_ICON_NAME] = g_param_spec_string ("icon-name", "icon-name", "", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); /** * TeplInfoBar:handle-close-response: * * If this property is %TRUE, then the #TeplInfoBar is destroyed with * gtk_widget_destroy() when the #GtkInfoBar::response signal is * received with the @response_id %GTK_RESPONSE_CLOSE. * * Since: 6.0 */ properties[PROP_HANDLE_CLOSE_RESPONSE] = g_param_spec_boolean ("handle-close-response", "handle-close-response", "", FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static const gchar * get_icon_name_for_message_type (TeplInfoBar *info_bar) { GtkMessageType msg_type; msg_type = gtk_info_bar_get_message_type (GTK_INFO_BAR (info_bar)); switch (msg_type) { case GTK_MESSAGE_INFO: return "dialog-information"; case GTK_MESSAGE_WARNING: return "dialog-warning"; case GTK_MESSAGE_QUESTION: return "dialog-question"; case GTK_MESSAGE_ERROR: return "dialog-error"; case GTK_MESSAGE_OTHER: default: /* No icon */ break; } return NULL; } static const gchar * get_real_icon_name (TeplInfoBar *info_bar) { if (info_bar->priv->icon_name != NULL) { return info_bar->priv->icon_name; } if (info_bar->priv->icon_from_message_type) { return get_icon_name_for_message_type (info_bar); } return NULL; } static void update_icon_state (TeplInfoBar *info_bar) { const gchar *icon_name; icon_name = get_real_icon_name (info_bar); if (icon_name != NULL) { gtk_image_set_from_icon_name (info_bar->priv->icon, icon_name, GTK_ICON_SIZE_DIALOG); gtk_widget_show (GTK_WIDGET (info_bar->priv->icon)); } else { gtk_widget_hide (GTK_WIDGET (info_bar->priv->icon)); } } static void message_type_notify_cb (TeplInfoBar *info_bar, GParamSpec *pspec, gpointer user_data) { update_icon_state (info_bar); } static void tepl_info_bar_init (TeplInfoBar *info_bar) { GtkGrid *hgrid; GtkWidget *content_area; info_bar->priv = tepl_info_bar_get_instance_private (info_bar); /* info_bar config */ _tepl_info_bar_set_size_request (GTK_INFO_BAR (info_bar)); tepl_info_bar_set_buttons_orientation (GTK_INFO_BAR (info_bar), GTK_ORIENTATION_VERTICAL); /* Icon */ info_bar->priv->icon = GTK_IMAGE (gtk_image_new ()); gtk_widget_set_valign (GTK_WIDGET (info_bar->priv->icon), GTK_ALIGN_START); gtk_widget_set_no_show_all (GTK_WIDGET (info_bar->priv->icon), TRUE); /* priv->vgrid_alongside_icon: can contain primary/secondary messages * plus additional widgets. */ info_bar->priv->vgrid_alongside_icon = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (info_bar->priv->vgrid_alongside_icon), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (info_bar->priv->vgrid_alongside_icon, 6); /* hgrid: icon on the left, priv->vgrid_alongside_icon on the right. */ hgrid = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (hgrid), GTK_ORIENTATION_HORIZONTAL); gtk_grid_set_column_spacing (hgrid, 16); gtk_container_add (GTK_CONTAINER (hgrid), GTK_WIDGET (info_bar->priv->icon)); gtk_container_add (GTK_CONTAINER (hgrid), GTK_WIDGET (info_bar->priv->vgrid_alongside_icon)); /* priv->vgrid_main */ info_bar->priv->vgrid_main = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (info_bar->priv->vgrid_main), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (info_bar->priv->vgrid_main, 6); gtk_container_add (GTK_CONTAINER (info_bar->priv->vgrid_main), GTK_WIDGET (hgrid)); /* content_area */ content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar)); gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET (info_bar->priv->vgrid_main)); gtk_widget_show_all (content_area); g_signal_connect (info_bar, "notify::message-type", G_CALLBACK (message_type_notify_cb), NULL); } /** * tepl_info_bar_new: * * Returns: a new #TeplInfoBar. * Since: 1.0 */ TeplInfoBar * tepl_info_bar_new (void) { return g_object_new (TEPL_TYPE_INFO_BAR, NULL); } /** * tepl_info_bar_new_simple: * @msg_type: the message type. * @primary_msg: the primary message. * @secondary_msg: (nullable): the secondary message, or %NULL. * * Creates a new #TeplInfoBar with an icon (depending on @msg_type), a primary * message and a secondary message. * * Returns: a new #TeplInfoBar. * Since: 2.0 */ TeplInfoBar * tepl_info_bar_new_simple (GtkMessageType msg_type, const gchar *primary_msg, const gchar *secondary_msg) { TeplInfoBar *info_bar; g_return_val_if_fail (primary_msg != NULL, NULL); info_bar = tepl_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), msg_type); tepl_info_bar_set_icon_from_message_type (info_bar, TRUE); tepl_info_bar_add_primary_message (info_bar, primary_msg); if (secondary_msg != NULL) { tepl_info_bar_add_secondary_message (info_bar, secondary_msg); } return info_bar; } /** * tepl_info_bar_get_icon_from_message_type: * @info_bar: a #TeplInfoBar. * * Returns: the value of the #TeplInfoBar:icon-from-message-type property. * Since: 6.0 */ gboolean tepl_info_bar_get_icon_from_message_type (TeplInfoBar *info_bar) { g_return_val_if_fail (TEPL_IS_INFO_BAR (info_bar), FALSE); return info_bar->priv->icon_from_message_type; } /** * tepl_info_bar_set_icon_from_message_type: * @info_bar: a #TeplInfoBar. * @icon_from_message_type: the new value. * * Sets a new value to the #TeplInfoBar:icon-from-message-type property. * * Since: 6.0 */ void tepl_info_bar_set_icon_from_message_type (TeplInfoBar *info_bar, gboolean icon_from_message_type) { g_return_if_fail (TEPL_IS_INFO_BAR (info_bar)); icon_from_message_type = icon_from_message_type != FALSE; if (info_bar->priv->icon_from_message_type != icon_from_message_type) { info_bar->priv->icon_from_message_type = icon_from_message_type; update_icon_state (info_bar); g_object_notify_by_pspec (G_OBJECT (info_bar), properties[PROP_ICON_FROM_MESSAGE_TYPE]); } } /** * tepl_info_bar_get_icon_name: * @info_bar: a #TeplInfoBar. * * Returns: the value of the #TeplInfoBar:icon-name property. * Since: 6.0 */ const gchar * tepl_info_bar_get_icon_name (TeplInfoBar *info_bar) { g_return_val_if_fail (TEPL_IS_INFO_BAR (info_bar), NULL); return info_bar->priv->icon_name; } /** * tepl_info_bar_set_icon_name: * @info_bar: a #TeplInfoBar. * @icon_name: the new value. * * Sets a new value to the #TeplInfoBar:icon-name property. * * Since: 6.0 */ void tepl_info_bar_set_icon_name (TeplInfoBar *info_bar, const gchar *icon_name) { g_return_if_fail (TEPL_IS_INFO_BAR (info_bar)); if (g_strcmp0 (info_bar->priv->icon_name, icon_name) != 0) { g_free (info_bar->priv->icon_name); info_bar->priv->icon_name = g_strdup (icon_name); update_icon_state (info_bar); g_object_notify_by_pspec (G_OBJECT (info_bar), properties[PROP_ICON_NAME]); } } /** * tepl_info_bar_add_primary_message: * @info_bar: a #TeplInfoBar. * @primary_msg: a primary message. * * Adds a primary message to the %TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON * location. * * Since: 2.0 */ void tepl_info_bar_add_primary_message (TeplInfoBar *info_bar, const gchar *primary_msg) { gchar *primary_msg_escaped; gchar *primary_markup; GtkLabel *primary_label; g_return_if_fail (TEPL_IS_INFO_BAR (info_bar)); g_return_if_fail (primary_msg != NULL); primary_msg_escaped = tepl_utils_markup_escape_text (primary_msg); primary_markup = g_strdup_printf ("%s", primary_msg_escaped); primary_label = tepl_info_bar_create_label (); gtk_label_set_markup (primary_label, primary_markup); g_free (primary_markup); g_free (primary_msg_escaped); gtk_widget_show (GTK_WIDGET (primary_label)); tepl_info_bar_add_content_widget (info_bar, GTK_WIDGET (primary_label), TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON); } /** * tepl_info_bar_add_secondary_message: * @info_bar: a #TeplInfoBar. * @secondary_msg: a secondary message. * * Adds a secondary message to the %TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON * location. * * Since: 2.0 */ void tepl_info_bar_add_secondary_message (TeplInfoBar *info_bar, const gchar *secondary_msg) { gchar *secondary_msg_escaped; gchar *secondary_markup; GtkLabel *secondary_label; g_return_if_fail (TEPL_IS_INFO_BAR (info_bar)); g_return_if_fail (secondary_msg != NULL); secondary_msg_escaped = tepl_utils_markup_escape_text (secondary_msg); secondary_markup = g_strdup_printf ("%s", secondary_msg_escaped); secondary_label = tepl_info_bar_create_label (); gtk_label_set_markup (secondary_label, secondary_markup); g_free (secondary_markup); g_free (secondary_msg_escaped); gtk_widget_show (GTK_WIDGET (secondary_label)); tepl_info_bar_add_content_widget (info_bar, GTK_WIDGET (secondary_label), TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON); } /** * tepl_info_bar_add_content_widget: * @info_bar: a #TeplInfoBar. * @widget: a #GtkWidget. * @location: a #TeplInfoBarLocation. * * Adds @widget to @info_bar at @location. * * As described in #TeplInfoBarLocation, a #TeplInfoBar has internal containers * for the content area. So if you need to add a custom #GtkWidget, it is better * to use this function instead of adding the #GtkWidget directly to the content * area. * * Since: 6.0 */ void tepl_info_bar_add_content_widget (TeplInfoBar *info_bar, GtkWidget *widget, TeplInfoBarLocation location) { g_return_if_fail (TEPL_IS_INFO_BAR (info_bar)); g_return_if_fail (GTK_IS_WIDGET (widget)); switch (location) { case TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON: gtk_container_add (GTK_CONTAINER (info_bar->priv->vgrid_alongside_icon), widget); break; case TEPL_INFO_BAR_LOCATION_BELOW_ICON: gtk_container_add (GTK_CONTAINER (info_bar->priv->vgrid_main), widget); break; default: g_warn_if_reached (); break; } } /** * tepl_info_bar_get_handle_close_response: * @info_bar: a #TeplInfoBar. * * Returns: the value of the #TeplInfoBar:handle-close-response property. * Since: 6.0 */ gboolean tepl_info_bar_get_handle_close_response (TeplInfoBar *info_bar) { g_return_val_if_fail (TEPL_IS_INFO_BAR (info_bar), FALSE); return info_bar->priv->handle_close_response; } /** * tepl_info_bar_set_handle_close_response: * @info_bar: a #TeplInfoBar. * @handle_close_response: the new value. * * Sets a new value to the #TeplInfoBar:handle-close-response property. * * Since: 6.0 */ void tepl_info_bar_set_handle_close_response (TeplInfoBar *info_bar, gboolean handle_close_response) { g_return_if_fail (TEPL_IS_INFO_BAR (info_bar)); handle_close_response = handle_close_response != FALSE; if (info_bar->priv->handle_close_response != handle_close_response) { info_bar->priv->handle_close_response = handle_close_response; g_object_notify_by_pspec (G_OBJECT (info_bar), properties[PROP_HANDLE_CLOSE_RESPONSE]); } } /** * tepl_info_bar_setup_close_button: * @info_bar: a #TeplInfoBar. * * Convenience function to set the #GtkInfoBar:show-close-button and * #TeplInfoBar:handle-close-response properties to %TRUE. * * Since: 6.0 */ void tepl_info_bar_setup_close_button (TeplInfoBar *info_bar) { g_return_if_fail (TEPL_IS_INFO_BAR (info_bar)); gtk_info_bar_set_show_close_button (GTK_INFO_BAR (info_bar), TRUE); tepl_info_bar_set_handle_close_response (info_bar, TRUE); } /** * tepl_info_bar_set_buttons_orientation: * @info_bar: a #GtkInfoBar. * @buttons_orientation: the desired orientation. * * Sets the desired orientation (horizontal or vertical) for the action area as * returned by gtk_info_bar_get_action_area(). The action area is where the * buttons are placed. * * The default value for a #TeplInfoBar is %GTK_ORIENTATION_VERTICAL. The reason * is because with a small #GtkWindow, if 3 or more buttons are shown * horizontally, there is not enough space for the text. And it can be worse * when the button labels are translated to another language. When the buttons * are packed vertically, there is usually no problem. A vertical action area * also follows the original design of #GtkInfoBar. * * Since: 6.0 */ void tepl_info_bar_set_buttons_orientation (GtkInfoBar *info_bar, GtkOrientation buttons_orientation) { GtkWidget *action_area; g_return_if_fail (GTK_IS_INFO_BAR (info_bar)); action_area = gtk_info_bar_get_action_area (info_bar); if (GTK_IS_ORIENTABLE (action_area)) { gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area), buttons_orientation); } else { g_warning ("Failed to set the orientation for the GtkInfoBar action area."); } } /** * tepl_info_bar_create_label: * * Utility function to create a #GtkLabel suitable for a #GtkInfoBar. The * wrapping and alignment is configured. The label is also set as selectable, * for example to copy an error message and search an explanation on the web. * * Returns: (transfer floating): a new #GtkLabel suitable for a #GtkInfoBar. * Since: 1.0 */ GtkLabel * tepl_info_bar_create_label (void) { GtkLabel *label; label = GTK_LABEL (gtk_label_new (NULL)); gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_START); gtk_label_set_xalign (label, 0.0); gtk_label_set_line_wrap (label, TRUE); gtk_label_set_line_wrap_mode (label, PANGO_WRAP_WORD_CHAR); gtk_label_set_selectable (label, TRUE); /* Since the wrapping is enabled, we need to set a minimum width. * * If a minimum width is not set, adding an info bar to a container * (e.g. a TeplTab) can make the GtkWindow height to grow. Because * without a minimum width (and without ellipsization), when the user * resizes the window (e.g. reducing the width) the widgets inside the * window must be able to be drawn. When the info bar must be drawn with * a width of e.g. 20 pixels, it takes a huge height because of the text * wrapping. So by setting a minimum width to the label, the maximum * height that the info bar can take is limited, so in most cases the * GtkWindow current height is sufficient to draw the info bar with its * maximum height. * * See: * https://wiki.gnome.org/HowDoI/Labels * * There is also a safety net with _tepl_info_bar_set_size_request(). */ gtk_label_set_width_chars (label, 30); return label; } void _tepl_info_bar_set_size_request (GtkInfoBar *info_bar) { gint min_width; gint min_height; g_return_if_fail (GTK_IS_INFO_BAR (info_bar)); gtk_widget_get_size_request (GTK_WIDGET (info_bar), &min_width, &min_height); /* If min_width != -1, gtk_widget_set_size_request() has already been * called, so don't change the value. */ if (min_width == -1) { /* Safety net to avoid in most cases the GtkWindow height to * grow. * * The gtk_label_set_width_chars() call in * tepl_info_bar_create_label() fixes the problem at the root, * but we cannot enforce all GtkLabel of @info_bar to be created * with tepl_info_bar_create_label(), so a safety net is better. */ gtk_widget_set_size_request (GTK_WIDGET (info_bar), 300, min_height); } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-info-bar.h000066400000000000000000000076131526404732400257770ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_INFO_BAR_H #define TEPL_INFO_BAR_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_INFO_BAR (tepl_info_bar_get_type ()) #define TEPL_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_INFO_BAR, TeplInfoBar)) #define TEPL_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_INFO_BAR, TeplInfoBarClass)) #define TEPL_IS_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_INFO_BAR)) #define TEPL_IS_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_INFO_BAR)) #define TEPL_INFO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_INFO_BAR, TeplInfoBarClass)) typedef struct _TeplInfoBar TeplInfoBar; typedef struct _TeplInfoBarClass TeplInfoBarClass; typedef struct _TeplInfoBarPrivate TeplInfoBarPrivate; struct _TeplInfoBar { GtkInfoBar parent; TeplInfoBarPrivate *priv; }; struct _TeplInfoBarClass { GtkInfoBarClass parent_class; gpointer padding[12]; }; /** * TeplInfoBarLocation: * @TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON: on the right side of the icon. * @TEPL_INFO_BAR_LOCATION_BELOW_ICON: below the icon. * * Location inside the content area. * * The content area of a #TeplInfoBar contains a vertical container containing: * - First, an horizontal container containing: * - A place for an optional icon. * - The %TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON location, which is a vertical * container that can contain: primary/secondary messages plus additional * widgets, in the order that they are added. * - The %TEPL_INFO_BAR_LOCATION_BELOW_ICON location, which can contain * additional widgets, in the order that they are added. So the widgets added * here are under the icon and under the * %TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON location. * * Since: 6.0 */ typedef enum { TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON, TEPL_INFO_BAR_LOCATION_BELOW_ICON } TeplInfoBarLocation; G_MODULE_EXPORT GType tepl_info_bar_get_type (void); G_MODULE_EXPORT TeplInfoBar * tepl_info_bar_new (void); G_MODULE_EXPORT TeplInfoBar * tepl_info_bar_new_simple (GtkMessageType msg_type, const gchar *primary_msg, const gchar *secondary_msg); G_MODULE_EXPORT gboolean tepl_info_bar_get_icon_from_message_type (TeplInfoBar *info_bar); G_MODULE_EXPORT void tepl_info_bar_set_icon_from_message_type (TeplInfoBar *info_bar, gboolean icon_from_message_type); G_MODULE_EXPORT const gchar * tepl_info_bar_get_icon_name (TeplInfoBar *info_bar); G_MODULE_EXPORT void tepl_info_bar_set_icon_name (TeplInfoBar *info_bar, const gchar *icon_name); G_MODULE_EXPORT void tepl_info_bar_add_primary_message (TeplInfoBar *info_bar, const gchar *primary_msg); G_MODULE_EXPORT void tepl_info_bar_add_secondary_message (TeplInfoBar *info_bar, const gchar *secondary_msg); G_MODULE_EXPORT void tepl_info_bar_add_content_widget (TeplInfoBar *info_bar, GtkWidget *widget, TeplInfoBarLocation location); G_MODULE_EXPORT gboolean tepl_info_bar_get_handle_close_response (TeplInfoBar *info_bar); G_MODULE_EXPORT void tepl_info_bar_set_handle_close_response (TeplInfoBar *info_bar, gboolean handle_close_response); G_MODULE_EXPORT void tepl_info_bar_setup_close_button (TeplInfoBar *info_bar); G_MODULE_EXPORT void tepl_info_bar_set_buttons_orientation (GtkInfoBar *info_bar, GtkOrientation buttons_orientation); G_MODULE_EXPORT GtkLabel * tepl_info_bar_create_label (void); G_GNUC_INTERNAL void _tepl_info_bar_set_size_request (GtkInfoBar *info_bar); G_END_DECLS #endif /* TEPL_INFO_BAR_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-init.c000066400000000000000000000057071526404732400252420ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-init.h" #include #include #include #include #include #include "tepl-abstract-factory.h" #include "tepl-metadata-manager.h" #include "tepl-prefs-dialog.h" #include "tepl-settings.h" static gchar * get_locale_directory (void) { #ifdef G_OS_WIN32 gchar *base_dir; gchar *locale_dir; base_dir = g_win32_get_package_installation_directory_of_module (NULL); locale_dir = g_build_filename (base_dir, "share", "locale", NULL); g_free (base_dir); return locale_dir; #else return g_strdup (TEPL_LOCALEDIR); #endif } /** * tepl_init: * * Initializes the Tepl library (e.g. for the internationalization). * * This function can be called several times, but is meant to be called at the * beginning of main(), before any other Tepl function call. * * This function also calls amtk_init(), gfls_init() and gtk_source_init(). * * Since: 3.0 */ void tepl_init (void) { static gboolean done = FALSE; if (!done) { gchar *locale_dir; amtk_init (); gfls_init (); gtk_source_init (); locale_dir = get_locale_directory (); bindtextdomain (GETTEXT_PACKAGE, locale_dir); g_free (locale_dir); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); done = TRUE; } } /** * tepl_finalize: * * Free the resources allocated by Tepl. For example it unrefs the singleton * objects. * * This function also calls amtk_finalize(), gfls_finalize() and * gtk_source_finalize(). * * It is not mandatory to call this function, it's just to be friendlier to * memory debugging tools. This function is meant to be called at the end of * main(). It can be called several times. * * Since: 3.0 */ /* Another way is to use a DSO destructor, see gconstructor.h in GLib. * * The advantage of calling tepl_finalize() at the end of main() is that * gobject-list [1] correctly reports that all Tepl* objects have been finalized * when quitting the application. On the other hand a DSO destructor runs after * the gobject-list's last output, so it's much less convenient, see: * https://git.gnome.org/browse/gtksourceview/commit/?id=e761de9c2bee90c232875bbc41e6e73e1f63e145 * * [1] A tool for debugging the lifetime of GObjects: * https://github.com/danni/gobject-list */ void tepl_finalize (void) { static gboolean done = FALSE; if (!done) { _tepl_abstract_factory_unref_singleton (); _tepl_metadata_manager_unref_singleton (); _tepl_prefs_dialog_unref_singleton (); _tepl_settings_unref_singleton (); /* Since Tepl depends on Amtk and GtkSourceView, it's better to * first finalize Tepl stuff and then finalize the underlying * libraries, in case the Tepl singletons depend on Amtk or * GtkSourceView. */ gtk_source_finalize (); gfls_finalize (); amtk_finalize (); u_cleanup (); done = TRUE; } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-init.h000066400000000000000000000006771526404732400252500ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_INIT_H #define TEPL_INIT_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT void tepl_init (void); G_MODULE_EXPORT void tepl_finalize (void); G_END_DECLS #endif /* TEPL_INIT_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-io-error-info-bars.c000066400000000000000000000231011526404732400276770ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2005 - Paolo Maggi * SPDX-FileCopyrightText: 2020-2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-io-error-info-bars.h" #include #include "tepl-utils.h" /** * SECTION:io-error-info-bars * @Short_description: Verbose error reporting for file I/O operations * @Title: IO error info bars * * Verbose error reporting for file I/O operations. */ static gchar * get_filename_for_display (GFile *location) { gchar *parse_name; gchar *filename_for_display; parse_name = g_file_get_parse_name (location); filename_for_display = tepl_utils_replace_home_dir_with_tilde (parse_name); g_free (parse_name); return filename_for_display; } /** * tepl_io_error_info_bar_file_already_open: * @location: the #GFile already open in another window. * * Creates a warning about @location being already open in another window, * offering two possible actions: * - Edit anyway: %GTK_RESPONSE_YES. * - Don't edit: %GTK_RESPONSE_CANCEL. * * Returns: (transfer floating): the newly created #TeplInfoBar. * Since: 5.0 */ TeplInfoBar * tepl_io_error_info_bar_file_already_open (GFile *location) { TeplInfoBar *info_bar; gchar *filename; gchar *filename_in_italic; gchar *app_name_escaped; gchar *primary_text; gchar *primary_text_in_bold; GtkLabel *primary_label; gchar *secondary_msg; g_return_val_if_fail (G_IS_FILE (location), NULL); g_return_val_if_fail (g_get_application_name () != NULL, NULL); info_bar = tepl_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING); tepl_info_bar_set_icon_from_message_type (info_bar, TRUE); /* Note that below the markup plus translatable strings is not handled * perfectly. But "perfect is the enemy of good". This should be: * "foo%sbar" with foo and bar both escaped. */ filename = get_filename_for_display (location); filename_in_italic = g_markup_printf_escaped ("%s", filename); app_name_escaped = tepl_utils_markup_escape_text (g_get_application_name ()); /* Translators: the first %s is a filename and the second %s is an * application name. */ primary_text = g_strdup_printf (_("This file (%s) is already open in another %s window."), filename_in_italic, app_name_escaped); primary_text_in_bold = g_strdup_printf ("%s", primary_text); primary_label = tepl_info_bar_create_label (); gtk_label_set_markup (primary_label, primary_text_in_bold); gtk_widget_show (GTK_WIDGET (primary_label)); tepl_info_bar_add_content_widget (info_bar, GTK_WIDGET (primary_label), TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON); secondary_msg = g_strdup_printf (_("%s opened this instance of the file in a non-editable way. " "Do you want to edit it anyway?"), g_get_application_name ()); tepl_info_bar_add_secondary_message (info_bar, secondary_msg); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Edit Anyway"), GTK_RESPONSE_YES); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Keep Read-Only"), GTK_RESPONSE_CANCEL); g_free (filename); g_free (filename_in_italic); g_free (app_name_escaped); g_free (primary_text); g_free (primary_text_in_bold); g_free (secondary_msg); return info_bar; } /** * tepl_io_error_info_bar_cant_create_backup: * @location: the #GFile for which the backup failed to be created. * @error: must be a %G_IO_ERROR_CANT_CREATE_BACKUP. * * When a %G_IO_ERROR_CANT_CREATE_BACKUP error occurs while saving @location, * offer two possible actions: * - Save anyway: %GTK_RESPONSE_YES. * - Don't save: %GTK_RESPONSE_CANCEL. * * Returns: (transfer floating): the newly created #TeplInfoBar. * Since: 5.0 */ TeplInfoBar * tepl_io_error_info_bar_cant_create_backup (GFile *location, const GError *error) { TeplInfoBar *info_bar; gchar *filename; gchar *primary_msg; const gchar *secondary_msg; g_return_val_if_fail (G_IS_FILE (location), NULL); g_return_val_if_fail (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANT_CREATE_BACKUP), NULL); info_bar = tepl_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING); tepl_info_bar_set_icon_from_message_type (info_bar, TRUE); filename = get_filename_for_display (location); primary_msg = g_strdup_printf (_("Could not create a backup file while saving “%s”."), filename); tepl_info_bar_add_primary_message (info_bar, primary_msg); g_free (filename); g_free (primary_msg); secondary_msg = _("Could not back up the old copy of the file before saving the new one. " "You can ignore this warning and save the file anyway, but if an error " "occurs while saving, you could lose the old copy of the file. Save anyway?"); tepl_info_bar_add_secondary_message (info_bar, secondary_msg); if (error->message != NULL) { gchar *error_msg; error_msg = g_strdup_printf (_("Error message: %s"), error->message); tepl_info_bar_add_secondary_message (info_bar, error_msg); g_free (error_msg); } gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Save Anyway"), GTK_RESPONSE_YES); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Don’t Save"), GTK_RESPONSE_CANCEL); return info_bar; } /** * tepl_io_error_info_bar_externally_modified: * @location: the #GFile for which there has been an external modification. * @document_modified: whether the document (e.g. the #GtkTextBuffer) has * unsaved modifications. * * Creates a warning about @location having changed on disk. The possible * actions: * - Depending on @document_modified, "Reload" or "Drop changes and reload": * %GTK_RESPONSE_OK. * - Ignore: %GTK_RESPONSE_CLOSE. * * Returns: (transfer floating): the newly created #TeplInfoBar. * Since: 5.0 */ TeplInfoBar * tepl_io_error_info_bar_externally_modified (GFile *location, gboolean document_modified) { TeplInfoBar *info_bar; gchar *filename; gchar *primary_msg; const gchar *secondary_msg; const gchar *button_text; g_return_val_if_fail (G_IS_FILE (location), NULL); info_bar = tepl_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING); tepl_info_bar_set_icon_from_message_type (info_bar, TRUE); filename = get_filename_for_display (location); primary_msg = g_strdup_printf (_("The file “%s” changed on disk."), filename); tepl_info_bar_add_primary_message (info_bar, primary_msg); g_free (filename); g_free (primary_msg); if (document_modified) { secondary_msg = _("This document has unsaved modifications. " "Do you want to drop your changes and reload the file?"); } else { secondary_msg = _("Do you want to reload the file?"); } tepl_info_bar_add_secondary_message (info_bar, secondary_msg); button_text = document_modified ? _("Drop Changes and _Reload") : _("_Reload"); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), button_text, GTK_RESPONSE_OK); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Ignore"), GTK_RESPONSE_CLOSE); return info_bar; } /** * tepl_io_error_info_bar_saving_externally_modified: * @location: a #GFile. * * When attempting to save @location, creates a warning about @location having * changed on disk. The possible actions: * - Save anyway: %GTK_RESPONSE_YES. * - Don't save: %GTK_RESPONSE_CANCEL. * * Returns: (transfer floating): the newly created #TeplInfoBar. * Since: 6.4 */ TeplInfoBar * tepl_io_error_info_bar_saving_externally_modified (GFile *location) { TeplInfoBar *info_bar; gchar *filename; gchar *primary_msg; const gchar *secondary_msg; g_return_val_if_fail (G_IS_FILE (location), NULL); filename = get_filename_for_display (location); primary_msg = g_strdup_printf (_("The file “%s” has been externally modified."), filename); secondary_msg = _("If you save it, all the external changes could be lost. Save it anyway?"); info_bar = tepl_info_bar_new_simple (GTK_MESSAGE_WARNING, primary_msg, secondary_msg); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Save Anyway"), GTK_RESPONSE_YES); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Don’t Save"), GTK_RESPONSE_CANCEL); g_free (filename); g_free (primary_msg); return info_bar; } /** * tepl_io_error_info_bar_invalid_characters: * @location: where to save the document. * * For file saving, creates a warning about invalid characters that can corrupt * the file. Possible actions: * - Save anyway: %GTK_RESPONSE_YES. * - Don't save: %GTK_RESPONSE_CANCEL. * * Returns: (transfer floating): the newly created #TeplInfoBar. * Since: 5.0 */ TeplInfoBar * tepl_io_error_info_bar_invalid_characters (GFile *location) { TeplInfoBar *info_bar; gchar *filename; gchar *primary_msg; const gchar *secondary_msg; g_return_val_if_fail (G_IS_FILE (location), NULL); info_bar = tepl_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING); tepl_info_bar_set_icon_from_message_type (info_bar, TRUE); filename = get_filename_for_display (location); primary_msg = g_strdup_printf (_("Some invalid characters have been detected while saving “%s”."), filename); tepl_info_bar_add_primary_message (info_bar, primary_msg); g_free (filename); g_free (primary_msg); secondary_msg = _("If you continue saving this file you can corrupt the document. " "Save anyway?"); tepl_info_bar_add_secondary_message (info_bar, secondary_msg); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Save Anyway"), GTK_RESPONSE_YES); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Don’t Save"), GTK_RESPONSE_CANCEL); return info_bar; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-io-error-info-bars.h000066400000000000000000000017331526404732400277130ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_IO_ERROR_INFO_BARS_H #define TEPL_IO_ERROR_INFO_BARS_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS G_MODULE_EXPORT TeplInfoBar * tepl_io_error_info_bar_file_already_open (GFile *location); G_MODULE_EXPORT TeplInfoBar * tepl_io_error_info_bar_cant_create_backup (GFile *location, const GError *error); G_MODULE_EXPORT TeplInfoBar * tepl_io_error_info_bar_externally_modified (GFile *location, gboolean document_modified); G_MODULE_EXPORT TeplInfoBar * tepl_io_error_info_bar_saving_externally_modified (GFile *location); G_MODULE_EXPORT TeplInfoBar * tepl_io_error_info_bar_invalid_characters (GFile *location); G_END_DECLS #endif /* TEPL_IO_ERROR_INFO_BARS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-language-chooser-dialog.c000066400000000000000000000121571526404732400307540ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-language-chooser-dialog.h" #include #include "tepl-language-chooser.h" #include "tepl-language-chooser-widget.h" /** * SECTION:language-chooser-dialog * @Title: TeplLanguageChooserDialog * @Short_description: A dialog for choosing a #GtkSourceLanguage * * #TeplLanguageChooserDialog is a #GtkDialog to choose a #GtkSourceLanguage. * #TeplLanguageChooserDialog implements the #TeplLanguageChooser interface. * * The #GtkDialog contains two buttons: Cancel and Select. During the * #GtkDialog::response signal emission, if the user has clicked on the Select * button, then the #TeplLanguageChooser::language-activated signal is emitted. * * You probably want to connect to the #GtkDialog::response signal with the * %G_CONNECT_AFTER flag, to destroy the dialog. */ struct _TeplLanguageChooserDialogPrivate { TeplLanguageChooserWidget *chooser_widget; }; static void tepl_language_chooser_interface_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (TeplLanguageChooserDialog, tepl_language_chooser_dialog, GTK_TYPE_DIALOG, G_ADD_PRIVATE (TeplLanguageChooserDialog) G_IMPLEMENT_INTERFACE (TEPL_TYPE_LANGUAGE_CHOOSER, tepl_language_chooser_interface_init)) static void tepl_language_chooser_dialog_dispose (GObject *object) { TeplLanguageChooserDialog *chooser_dialog = TEPL_LANGUAGE_CHOOSER_DIALOG (object); chooser_dialog->priv->chooser_widget = NULL; G_OBJECT_CLASS (tepl_language_chooser_dialog_parent_class)->dispose (object); } static void tepl_language_chooser_dialog_response (GtkDialog *dialog, gint response_id) { TeplLanguageChooserDialog *chooser_dialog = TEPL_LANGUAGE_CHOOSER_DIALOG (dialog); if (response_id == GTK_RESPONSE_OK) { _tepl_language_chooser_widget_activate_selected_language (chooser_dialog->priv->chooser_widget); } if (GTK_DIALOG_CLASS (tepl_language_chooser_dialog_parent_class)->response != NULL) { GTK_DIALOG_CLASS (tepl_language_chooser_dialog_parent_class)->response (dialog, response_id); } } static void tepl_language_chooser_dialog_class_init (TeplLanguageChooserDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass); object_class->dispose = tepl_language_chooser_dialog_dispose; dialog_class->response = tepl_language_chooser_dialog_response; } static void tepl_language_chooser_dialog_select_language (TeplLanguageChooser *chooser, GtkSourceLanguage *language) { TeplLanguageChooserDialog *chooser_dialog = TEPL_LANGUAGE_CHOOSER_DIALOG (chooser); tepl_language_chooser_select_language (TEPL_LANGUAGE_CHOOSER (chooser_dialog->priv->chooser_widget), language); } static void tepl_language_chooser_interface_init (gpointer g_iface, gpointer iface_data) { TeplLanguageChooserInterface *interface = g_iface; interface->select_language = tepl_language_chooser_dialog_select_language; } static void chooser_widget_language_activated_cb (TeplLanguageChooserWidget *chooser_widget, GtkSourceLanguage *language, TeplLanguageChooserDialog *chooser_dialog) { if (language != NULL) { g_object_ref (language); } g_signal_emit_by_name (chooser_dialog, "language-activated", language); if (language != NULL) { g_object_unref (language); } } static void tepl_language_chooser_dialog_init (TeplLanguageChooserDialog *chooser_dialog) { GtkBox *content_area; chooser_dialog->priv = tepl_language_chooser_dialog_get_instance_private (chooser_dialog); /* chooser_dialog config */ gtk_window_set_title (GTK_WINDOW (chooser_dialog), _("Highlight Mode")); gtk_window_set_modal (GTK_WINDOW (chooser_dialog), TRUE); /* Action area */ gtk_dialog_add_buttons (GTK_DIALOG (chooser_dialog), _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Select"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (chooser_dialog), GTK_RESPONSE_OK); /* Content area: the TeplLanguageChooserWidget */ chooser_dialog->priv->chooser_widget = tepl_language_chooser_widget_new (); gtk_container_set_border_width (GTK_CONTAINER (chooser_dialog->priv->chooser_widget), 11); g_signal_connect (chooser_dialog->priv->chooser_widget, "language-activated", G_CALLBACK (chooser_widget_language_activated_cb), chooser_dialog); content_area = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (chooser_dialog))); gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET (chooser_dialog->priv->chooser_widget)); gtk_widget_show_all (GTK_WIDGET (content_area)); } /** * tepl_language_chooser_dialog_new: * @parent: (nullable): transient parent of the dialog, or %NULL. * * Returns: a new #TeplLanguageChooserDialog widget. * Since: 6.0 */ TeplLanguageChooserDialog * tepl_language_chooser_dialog_new (GtkWindow *parent) { g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), NULL); return g_object_new (TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG, "transient-for", parent, "use-header-bar", TRUE, NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-language-chooser-dialog.h000066400000000000000000000034711526404732400307600ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_LANGUAGE_CHOOSER_DIALOG_H #define TEPL_LANGUAGE_CHOOSER_DIALOG_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG (tepl_language_chooser_dialog_get_type ()) #define TEPL_LANGUAGE_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG, TeplLanguageChooserDialog)) #define TEPL_LANGUAGE_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG, TeplLanguageChooserDialogClass)) #define TEPL_IS_LANGUAGE_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG)) #define TEPL_IS_LANGUAGE_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG)) #define TEPL_LANGUAGE_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_LANGUAGE_CHOOSER_DIALOG, TeplLanguageChooserDialogClass)) typedef struct _TeplLanguageChooserDialog TeplLanguageChooserDialog; typedef struct _TeplLanguageChooserDialogClass TeplLanguageChooserDialogClass; typedef struct _TeplLanguageChooserDialogPrivate TeplLanguageChooserDialogPrivate; struct _TeplLanguageChooserDialog { GtkDialog parent; TeplLanguageChooserDialogPrivate *priv; }; struct _TeplLanguageChooserDialogClass { GtkDialogClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_language_chooser_dialog_get_type (void); G_MODULE_EXPORT TeplLanguageChooserDialog * tepl_language_chooser_dialog_new (GtkWindow *parent); G_END_DECLS #endif /* TEPL_LANGUAGE_CHOOSER_DIALOG_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-language-chooser-widget.c000066400000000000000000000353741526404732400310060ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-language-chooser-widget.h" #include #include "tepl-language-chooser.h" #include "tepl-utils.h" /** * SECTION:language-chooser-widget * @Title: TeplLanguageChooserWidget * @Short_description: A widget for choosing a #GtkSourceLanguage * * #TeplLanguageChooserWidget is a #GtkWidget to choose a #GtkSourceLanguage. * #TeplLanguageChooserWidget implements the #TeplLanguageChooser interface. * * In addition to the list, it contains a #GtkSearchEntry to search the list. */ struct _TeplLanguageChooserWidgetPrivate { GtkSearchEntry *search_entry; GtkListBox *list_box; }; #define LIST_BOX_ROW_LANGUAGE_KEY "language-key" static void tepl_language_chooser_interface_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (TeplLanguageChooserWidget, tepl_language_chooser_widget, GTK_TYPE_GRID, G_ADD_PRIVATE (TeplLanguageChooserWidget) G_IMPLEMENT_INTERFACE (TEPL_TYPE_LANGUAGE_CHOOSER, tepl_language_chooser_interface_init)) static gboolean filter_cb (GtkListBoxRow *list_box_row, gpointer user_data); /* Could be moved to tepl-utils, but it would require to make it more general, * for all GtkListBox scenarios ideally (with non-selectable rows, headers, * etc). Or by documenting the limitations. */ static void list_box_select_first_row (GtkListBox *list_box, GtkListBoxFilterFunc filter_func, gpointer user_data) { GtkListBoxRow *row; row = tepl_utils_list_box_get_row_at_index_with_filter (list_box, 0, filter_func, user_data); gtk_list_box_select_row (list_box, row); if (row != NULL) { tepl_utils_list_box_scroll_to_row (list_box, row); } } static void select_first_row (TeplLanguageChooserWidget *chooser_widget) { list_box_select_first_row (chooser_widget->priv->list_box, filter_cb, chooser_widget); } static const gchar * get_language_name (GtkSourceLanguage *language) { if (language == NULL) { return _("Plain Text"); } return gtk_source_language_get_name (language); } static void list_box_row_set_language (GtkListBoxRow *list_box_row, GtkSourceLanguage *language) { g_object_set_data_full (G_OBJECT (list_box_row), LIST_BOX_ROW_LANGUAGE_KEY, g_object_ref (language), g_object_unref); } /* Returns: (transfer none). */ static GtkSourceLanguage * list_box_row_get_language (GtkListBoxRow *list_box_row) { return g_object_get_data (G_OBJECT (list_box_row), LIST_BOX_ROW_LANGUAGE_KEY); } static void tepl_language_chooser_widget_dispose (GObject *object) { TeplLanguageChooserWidget *chooser_widget = TEPL_LANGUAGE_CHOOSER_WIDGET (object); chooser_widget->priv->search_entry = NULL; chooser_widget->priv->list_box = NULL; G_OBJECT_CLASS (tepl_language_chooser_widget_parent_class)->dispose (object); } static void tepl_language_chooser_widget_map (GtkWidget *widget) { TeplLanguageChooserWidget *chooser_widget = TEPL_LANGUAGE_CHOOSER_WIDGET (widget); if (GTK_WIDGET_CLASS (tepl_language_chooser_widget_parent_class)->map != NULL) { GTK_WIDGET_CLASS (tepl_language_chooser_widget_parent_class)->map (widget); } tepl_utils_list_box_scroll_to_selected_row (chooser_widget->priv->list_box); } static void tepl_language_chooser_widget_class_init (TeplLanguageChooserWidgetClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->dispose = tepl_language_chooser_widget_dispose; widget_class->map = tepl_language_chooser_widget_map; } static void tepl_language_chooser_widget_select_language (TeplLanguageChooser *chooser, GtkSourceLanguage *language) { TeplLanguageChooserWidget *chooser_widget = TEPL_LANGUAGE_CHOOSER_WIDGET (chooser); GList *all_rows; GList *l; all_rows = gtk_container_get_children (GTK_CONTAINER (chooser_widget->priv->list_box)); for (l = all_rows; l != NULL; l = l->next) { GtkListBoxRow *cur_row = GTK_LIST_BOX_ROW (l->data); GtkSourceLanguage *cur_language; cur_language = list_box_row_get_language (cur_row); if (cur_language == language) { gtk_list_box_select_row (chooser_widget->priv->list_box, cur_row); tepl_utils_list_box_scroll_to_row (chooser_widget->priv->list_box, cur_row); break; } } g_list_free (all_rows); } static void tepl_language_chooser_interface_init (gpointer g_iface, gpointer iface_data) { TeplLanguageChooserInterface *interface = g_iface; interface->select_language = tepl_language_chooser_widget_select_language; } static GtkListBoxRow * create_list_box_row (const gchar *label_text) { GtkWidget *label; GtkListBoxRow *list_box_row; label = gtk_label_new (label_text); gtk_label_set_xalign (GTK_LABEL (label), 0.0); list_box_row = GTK_LIST_BOX_ROW (gtk_list_box_row_new ()); gtk_container_add (GTK_CONTAINER (list_box_row), label); return list_box_row; } static void append_plain_text_item_to_list_box (TeplLanguageChooserWidget *chooser_widget) { /* NULL GtkSourceLanguage. */ gtk_container_add (GTK_CONTAINER (chooser_widget->priv->list_box), GTK_WIDGET (create_list_box_row (get_language_name (NULL)))); } static void append_language_to_list_box (TeplLanguageChooserWidget *chooser_widget, GtkSourceLanguage *language) { GtkListBoxRow *list_box_row; g_return_if_fail (GTK_SOURCE_IS_LANGUAGE (language)); list_box_row = create_list_box_row (gtk_source_language_get_name (language)); list_box_row_set_language (list_box_row, language); gtk_container_add (GTK_CONTAINER (chooser_widget->priv->list_box), GTK_WIDGET (list_box_row)); } static void populate_list_box (TeplLanguageChooserWidget *chooser_widget) { GtkSourceLanguageManager *language_manager; const gchar * const *language_ids; gint i; // First item append_plain_text_item_to_list_box (chooser_widget); language_manager = gtk_source_language_manager_get_default (); language_ids = gtk_source_language_manager_get_language_ids (language_manager); if (language_ids == NULL) { return; } for (i = 0; language_ids[i] != NULL; i++) { const gchar *cur_language_id = language_ids[i]; GtkSourceLanguage *language; language = gtk_source_language_manager_get_language (language_manager, cur_language_id); if (!gtk_source_language_get_hidden (language)) { append_language_to_list_box (chooser_widget, language); } } } static gboolean filter_cb (GtkListBoxRow *list_box_row, gpointer user_data) { TeplLanguageChooserWidget *chooser_widget = user_data; const gchar *search_text; GtkSourceLanguage *language; const gchar *item_name; gchar *item_name_normalized; gchar *item_name_casefolded; gchar *search_text_normalized; gchar *search_text_casefolded; gboolean visible = FALSE; search_text = gtk_entry_get_text (GTK_ENTRY (chooser_widget->priv->search_entry)); if (search_text == NULL || search_text[0] == '\0') { return TRUE; } language = list_box_row_get_language (list_box_row); item_name = get_language_name (language); g_return_val_if_fail (item_name != NULL, FALSE); /* Safer to check... (item_name can come from a *.lang file). */ g_return_val_if_fail (g_utf8_validate (search_text, -1, NULL), FALSE); g_return_val_if_fail (g_utf8_validate (item_name, -1, NULL), FALSE); item_name_normalized = g_utf8_normalize (item_name, -1, G_NORMALIZE_ALL); item_name_casefolded = g_utf8_casefold (item_name_normalized, -1); g_free (item_name_normalized); /* Note: we do not apply g_strstrip() on the search text, because a * trailing space (or - to a less extent - a leading space) can * differentiate several items, for example: * - "ERB" * - "ERB (HTML)" * - "ERB (JavaScript)" */ search_text_normalized = g_utf8_normalize (search_text, -1, G_NORMALIZE_ALL); search_text_casefolded = g_utf8_casefold (search_text_normalized, -1); g_free (search_text_normalized); if (item_name_casefolded != NULL && search_text_casefolded != NULL) { visible = strstr (item_name_casefolded, search_text_casefolded) != NULL; } g_free (item_name_casefolded); g_free (search_text_casefolded); return visible; } static void search_entry_changed_cb (GtkEditable *search_entry, TeplLanguageChooserWidget *chooser_widget) { /* Invalidate the filter directly, not in the * GtkSearchEntry::search-changed signal because ::search-changed is * emitted after a small delay, and the filter_cb() function is used * elsewhere in the code. To avoid inconsistencies. * * The delay is anyway not necessary because the list is small and is * updated quickly enough, after a quick test. */ gtk_list_box_invalidate_filter (chooser_widget->priv->list_box); select_first_row (chooser_widget); } static void emit_language_activated_for_row (TeplLanguageChooserWidget *chooser_widget, GtkListBoxRow *list_box_row) { GtkSourceLanguage *language; language = list_box_row_get_language (list_box_row); if (language != NULL) { g_object_ref (language); } g_signal_emit_by_name (chooser_widget, "language-activated", language); if (language != NULL) { g_object_unref (language); } } static void search_entry_activate_cb (GtkEntry *entry, TeplLanguageChooserWidget *chooser_widget) { _tepl_language_chooser_widget_activate_selected_language (chooser_widget); } static void list_box_row_activated_cb (GtkListBox *list_box, GtkListBoxRow *list_box_row, TeplLanguageChooserWidget *chooser_widget) { emit_language_activated_for_row (chooser_widget, list_box_row); } static void move_selection (TeplLanguageChooserWidget *chooser_widget, gint how_many) { GtkListBoxRow *selected_row; GtkListBoxRow **filtered_children = NULL; gint n_filtered_children; gint pos; gint selected_row_pos = 0; gboolean found = FALSE; gint new_row_to_select_pos; GtkListBoxRow *new_row_to_select; selected_row = gtk_list_box_get_selected_row (chooser_widget->priv->list_box); if (selected_row == NULL || !filter_cb (selected_row, chooser_widget)) { select_first_row (chooser_widget); return; } filtered_children = tepl_utils_list_box_get_filtered_children (chooser_widget->priv->list_box, filter_cb, chooser_widget, &n_filtered_children); if (filtered_children == NULL) { goto out; } for (pos = 0; filtered_children[pos] != NULL; pos++) { GtkListBoxRow *cur_row = filtered_children[pos]; if (cur_row == selected_row) { selected_row_pos = pos; found = TRUE; break; } } if (!found) { g_warn_if_reached (); goto out; } new_row_to_select_pos = selected_row_pos + how_many; new_row_to_select_pos = CLAMP (new_row_to_select_pos, 0, n_filtered_children - 1); new_row_to_select = filtered_children[new_row_to_select_pos]; gtk_list_box_select_row (chooser_widget->priv->list_box, new_row_to_select); tepl_utils_list_box_scroll_to_row (chooser_widget->priv->list_box, new_row_to_select); out: g_free (filtered_children); } static gboolean search_entry_key_press_event_cb (GtkWidget *search_entry, GdkEventKey *event, TeplLanguageChooserWidget *chooser_widget) { if (event->keyval == GDK_KEY_Down) { move_selection (chooser_widget, 1); return GDK_EVENT_STOP; } else if (event->keyval == GDK_KEY_Up) { move_selection (chooser_widget, -1); return GDK_EVENT_STOP; } else if (event->keyval == GDK_KEY_Page_Down) { move_selection (chooser_widget, 5); return GDK_EVENT_STOP; } else if (event->keyval == GDK_KEY_Page_Up) { move_selection (chooser_widget, -5); return GDK_EVENT_STOP; } return GDK_EVENT_PROPAGATE; } static void tepl_language_chooser_widget_init (TeplLanguageChooserWidget *chooser_widget) { GtkScrolledWindow *scrolled_window; chooser_widget->priv = tepl_language_chooser_widget_get_instance_private (chooser_widget); /* chooser_widget config */ gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser_widget), GTK_ORIENTATION_VERTICAL); gtk_widget_set_size_request (GTK_WIDGET (chooser_widget), 300, 400); gtk_grid_set_row_spacing (GTK_GRID (chooser_widget), 3); gtk_container_set_border_width (GTK_CONTAINER (chooser_widget), 6); /* GtkSearchEntry */ chooser_widget->priv->search_entry = GTK_SEARCH_ENTRY (gtk_search_entry_new ()); gtk_entry_set_placeholder_text (GTK_ENTRY (chooser_widget->priv->search_entry), _("Search highlight mode…")); gtk_widget_show (GTK_WIDGET (chooser_widget->priv->search_entry)); gtk_container_add (GTK_CONTAINER (chooser_widget), GTK_WIDGET (chooser_widget->priv->search_entry)); /* GtkListBox */ chooser_widget->priv->list_box = GTK_LIST_BOX (gtk_list_box_new ()); gtk_list_box_set_activate_on_single_click (chooser_widget->priv->list_box, FALSE); gtk_widget_set_hexpand (GTK_WIDGET (chooser_widget->priv->list_box), TRUE); gtk_widget_set_vexpand (GTK_WIDGET (chooser_widget->priv->list_box), TRUE); populate_list_box (chooser_widget); /* GtkScrolledWindow */ scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL)); gtk_scrolled_window_set_shadow_type (scrolled_window, GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (chooser_widget->priv->list_box)); gtk_widget_show_all (GTK_WIDGET (scrolled_window)); gtk_container_add (GTK_CONTAINER (chooser_widget), GTK_WIDGET (scrolled_window)); tepl_utils_list_box_setup_scrolling (chooser_widget->priv->list_box, scrolled_window); gtk_list_box_set_filter_func (chooser_widget->priv->list_box, filter_cb, chooser_widget, NULL); g_signal_connect (chooser_widget->priv->search_entry, "changed", G_CALLBACK (search_entry_changed_cb), chooser_widget); g_signal_connect (chooser_widget->priv->search_entry, "activate", G_CALLBACK (search_entry_activate_cb), chooser_widget); g_signal_connect (chooser_widget->priv->search_entry, "key-press-event", G_CALLBACK (search_entry_key_press_event_cb), chooser_widget); g_signal_connect (chooser_widget->priv->list_box, "row-activated", G_CALLBACK (list_box_row_activated_cb), chooser_widget); select_first_row (chooser_widget); gtk_widget_grab_focus (GTK_WIDGET (chooser_widget->priv->search_entry)); } /** * tepl_language_chooser_widget_new: * * Returns: (transfer floating): a new #TeplLanguageChooserWidget. * Since: 6.0 */ TeplLanguageChooserWidget * tepl_language_chooser_widget_new (void) { return g_object_new (TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET, NULL); } void _tepl_language_chooser_widget_activate_selected_language (TeplLanguageChooserWidget *chooser_widget) { GtkListBoxRow *selected_row; g_return_if_fail (TEPL_IS_LANGUAGE_CHOOSER_WIDGET (chooser_widget)); selected_row = gtk_list_box_get_selected_row (chooser_widget->priv->list_box); if (selected_row != NULL) { emit_language_activated_for_row (chooser_widget, selected_row); } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-language-chooser-widget.h000066400000000000000000000036731526404732400310100ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_LANGUAGE_CHOOSER_WIDGET_H #define TEPL_LANGUAGE_CHOOSER_WIDGET_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET (tepl_language_chooser_widget_get_type ()) #define TEPL_LANGUAGE_CHOOSER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET, TeplLanguageChooserWidget)) #define TEPL_LANGUAGE_CHOOSER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET, TeplLanguageChooserWidgetClass)) #define TEPL_IS_LANGUAGE_CHOOSER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET)) #define TEPL_IS_LANGUAGE_CHOOSER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET)) #define TEPL_LANGUAGE_CHOOSER_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_LANGUAGE_CHOOSER_WIDGET, TeplLanguageChooserWidgetClass)) typedef struct _TeplLanguageChooserWidget TeplLanguageChooserWidget; typedef struct _TeplLanguageChooserWidgetClass TeplLanguageChooserWidgetClass; typedef struct _TeplLanguageChooserWidgetPrivate TeplLanguageChooserWidgetPrivate; struct _TeplLanguageChooserWidget { GtkGrid parent; TeplLanguageChooserWidgetPrivate *priv; }; struct _TeplLanguageChooserWidgetClass { GtkGridClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_language_chooser_widget_get_type (void); G_MODULE_EXPORT TeplLanguageChooserWidget * tepl_language_chooser_widget_new (void); G_GNUC_INTERNAL void _tepl_language_chooser_widget_activate_selected_language (TeplLanguageChooserWidget *chooser_widget); G_END_DECLS #endif /* TEPL_LANGUAGE_CHOOSER_WIDGET_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-language-chooser.c000066400000000000000000000067601526404732400275220ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-language-chooser.h" /** * SECTION:language-chooser * @Title: TeplLanguageChooser * @Short_description: Interface implemented by widgets for choosing a #GtkSourceLanguage * * A #TeplLanguageChooser widget shows a list of available #GtkSourceLanguage's, * as returned by gtk_source_language_manager_get_default(). The list contains a * "Plain Text" item for the %NULL language. * * The typical workflow when using a #TeplLanguageChooser widget in an * application is: * 1. Create a #TeplLanguageChooser widget. * 2. Call tepl_language_chooser_select_language() with the value of the * #GtkSourceBuffer:language property. * 3. Wait for the #TeplLanguageChooser::language-activated signal to be emitted * and/or destroy the #TeplLanguageChooser widget. */ /* API design: * Consistency with GtkSourceStyleSchemeChooser: * - The name, but applied for GtkSourceLanguage. * - The fact to have an interface with different implementations. * * Previous names, in gedit: GeditHighlightModeSelector for the widget, * GeditHighlightModeDialog for the dialog. Without an interface, the Selector * object (used by composition) was exposed in the API of the Dialog, to avoid * repeating the API. */ /* TODO: implement a TeplLanguageChooserButton class. * For TeplLanguageChooserButton, it would probably be more convenient to have * two properties instead of the ::language-activated signal: the :language and * :language-id properties (the :language-id property would be useful to bind it * to a GSettings key). * A TeplLanguageChooserButton would be useful to choose the default language * for new files, by adding the button in a preferences dialog. */ enum { SIGNAL_LANGUAGE_ACTIVATED, N_SIGNALS }; static guint signals[N_SIGNALS]; G_DEFINE_INTERFACE (TeplLanguageChooser, tepl_language_chooser, G_TYPE_OBJECT) static void tepl_language_chooser_select_language_default (TeplLanguageChooser *chooser, GtkSourceLanguage *language) { } static void tepl_language_chooser_default_init (TeplLanguageChooserInterface *interface) { interface->select_language = tepl_language_chooser_select_language_default; /** * TeplLanguageChooser::language-activated: * @chooser: the #TeplLanguageChooser emitting the signal. * @language: (nullable): the #GtkSourceLanguage object that has been * selected, or %NULL if "Plain Text" has been selected. * * This signal is emitted when the user has chosen a language. * * Since: 6.0 */ /* Note about the signal name, it's to be consistent with * ::row-activated. */ signals[SIGNAL_LANGUAGE_ACTIVATED] = g_signal_new ("language-activated", G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (TeplLanguageChooserInterface, language_activated), NULL, NULL, NULL, G_TYPE_NONE, 1, GTK_SOURCE_TYPE_LANGUAGE); } /** * tepl_language_chooser_select_language: * @chooser: a #TeplLanguageChooser. * @language: (nullable): a #GtkSourceLanguage, or %NULL for "Plain Text". * * Selects @language in the list. * * Since: 6.0 */ void tepl_language_chooser_select_language (TeplLanguageChooser *chooser, GtkSourceLanguage *language) { g_return_if_fail (TEPL_IS_LANGUAGE_CHOOSER (chooser)); g_return_if_fail (language == NULL || GTK_SOURCE_IS_LANGUAGE (language)); TEPL_LANGUAGE_CHOOSER_GET_INTERFACE (chooser)->select_language (chooser, language); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-language-chooser.h000066400000000000000000000036221526404732400275210ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_LANGUAGE_CHOOSER_H #define TEPL_LANGUAGE_CHOOSER_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_LANGUAGE_CHOOSER (tepl_language_chooser_get_type ()) #define TEPL_LANGUAGE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_LANGUAGE_CHOOSER, TeplLanguageChooser)) #define TEPL_IS_LANGUAGE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_LANGUAGE_CHOOSER)) #define TEPL_LANGUAGE_CHOOSER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEPL_TYPE_LANGUAGE_CHOOSER, TeplLanguageChooserInterface)) typedef struct _TeplLanguageChooser TeplLanguageChooser; typedef struct _TeplLanguageChooserInterface TeplLanguageChooserInterface; /** * TeplLanguageChooserInterface: * @parent_interface: The parent interface. * @select_language: The virtual function pointer for tepl_language_chooser_select_language(). * By default, does nothing. * @language_activated: The function pointer for the * #TeplLanguageChooser::language-activated signal. * * The virtual function table for #TeplLanguageChooser. * * Since: 6.0 */ struct _TeplLanguageChooserInterface { GTypeInterface parent_interface; /* Interface functions */ void (* select_language) (TeplLanguageChooser *chooser, GtkSourceLanguage *language); /* Signals */ void (* language_activated) (TeplLanguageChooser *chooser, GtkSourceLanguage *language); }; G_MODULE_EXPORT GType tepl_language_chooser_get_type (void); G_MODULE_EXPORT void tepl_language_chooser_select_language (TeplLanguageChooser *chooser, GtkSourceLanguage *language); G_END_DECLS #endif /* TEPL_LANGUAGE_CHOOSER_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-line-column-indicator.c000066400000000000000000000223051526404732400304640ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-line-column-indicator.h" #include #include "tepl-signal-group.h" #include "tepl-utils.h" /** * SECTION:line-column-indicator * @Short_description: Indicates the cursor position * @Title: TeplLineColumnIndicator * * #TeplLineColumnIndicator indicates the cursor position by line and column * numbers. For example: "Ln 2, Col 3". * * The usual case is to pack this widget in a #GtkStatusbar. */ struct _TeplLineColumnIndicatorPrivate { GtkStack *stack; GtkLabel *label; /* If @tab_group is set, then @view is always %NULL. * If @tab_group is %NULL, then @view is used but may be %NULL. */ TeplView *view; /* owned */ TeplTabGroup *tab_group; /* owned */ TeplSignalGroup *view_signal_group; TeplSignalGroup *buffer_signal_group; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplLineColumnIndicator, tepl_line_column_indicator, GTK_TYPE_BIN) static gchar * get_label_text (gint line, gint column) { gchar *base_text; gchar *text_with_padding; /* Translators: "Ln" is an abbreviation for "Line", Col is an * abbreviation for "Column". Please, use abbreviations if possible. */ base_text = g_strdup_printf (_("Ln %d, Col %d"), line, column); text_with_padding = _tepl_utils_statusbar_add_padding_to_text (base_text); g_free (base_text); return text_with_padding; } static void set_values (TeplLineColumnIndicator *indicator, gint line, gint column) { gchar *text; g_return_if_fail (line >= 1); g_return_if_fail (column >= 1); text = get_label_text (line, column); gtk_label_set_text (indicator->priv->label, text); g_free (text); } static void set_values_for_view (TeplLineColumnIndicator *indicator, TeplView *view) { GtkTextBuffer *buffer; GtkTextIter iter; gint line; gint column; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer)); line = gtk_text_iter_get_line (&iter); column = gtk_source_view_get_visual_column (GTK_SOURCE_VIEW (view), &iter); set_values (indicator, line + 1, column + 1); } static TeplView * get_view (TeplLineColumnIndicator *indicator) { if (indicator->priv->tab_group != NULL) { return tepl_tab_group_get_active_view (indicator->priv->tab_group); } return indicator->priv->view; } static void update_cursor_position (TeplLineColumnIndicator *indicator) { TeplView *view = get_view (indicator); if (view == NULL) { gtk_widget_hide (GTK_WIDGET (indicator->priv->stack)); } else { set_values_for_view (indicator, view); gtk_widget_show (GTK_WIDGET (indicator->priv->stack)); } } static void tepl_line_column_indicator_dispose (GObject *object) { TeplLineColumnIndicator *indicator = TEPL_LINE_COLUMN_INDICATOR (object); tepl_signal_group_clear (&indicator->priv->view_signal_group); tepl_signal_group_clear (&indicator->priv->buffer_signal_group); tepl_utils_set_widget ((GtkWidget **) &indicator->priv->view, NULL); g_clear_object (&indicator->priv->tab_group); /* In case a public function is called after a first dispose. */ indicator->priv->label = NULL; G_OBJECT_CLASS (tepl_line_column_indicator_parent_class)->dispose (object); } static void tepl_line_column_indicator_class_init (TeplLineColumnIndicatorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_line_column_indicator_dispose; } static GtkWidget * create_label_for_size_allocation (void) { GtkWidget *label; gchar *text; text = get_label_text (9999, 999); label = gtk_label_new (text); gtk_widget_show (label); g_free (text); return label; } static void tepl_line_column_indicator_init (TeplLineColumnIndicator *indicator) { indicator->priv = tepl_line_column_indicator_get_instance_private (indicator); indicator->priv->stack = GTK_STACK (gtk_stack_new ()); gtk_widget_show (GTK_WIDGET (indicator->priv->stack)); indicator->priv->label = GTK_LABEL (gtk_label_new (NULL)); gtk_widget_show (GTK_WIDGET (indicator->priv->label)); gtk_container_add (GTK_CONTAINER (indicator->priv->stack), GTK_WIDGET (indicator->priv->label)); gtk_container_add (GTK_CONTAINER (indicator->priv->stack), create_label_for_size_allocation ()); /* The visible child never changes. The "label for size allocation" is * used only to reserve some space, to avoid this widget to "push" the * other widgets (that are usually placed on the left in the statusbar). */ gtk_stack_set_visible_child (indicator->priv->stack, GTK_WIDGET (indicator->priv->label)); gtk_container_add (GTK_CONTAINER (indicator), GTK_WIDGET (indicator->priv->stack)); } /** * tepl_line_column_indicator_new: * * Returns: (transfer floating): a new #TeplLineColumnIndicator widget. * Since: 6.4 */ TeplLineColumnIndicator * tepl_line_column_indicator_new (void) { return g_object_new (TEPL_TYPE_LINE_COLUMN_INDICATOR, NULL); } static void cursor_moved_cb (TeplBuffer *buffer, TeplLineColumnIndicator *indicator) { update_cursor_position (indicator); } static void connect_to_buffer (TeplLineColumnIndicator *indicator, TeplBuffer *buffer) { tepl_signal_group_clear (&indicator->priv->buffer_signal_group); if (buffer == NULL) { return; } indicator->priv->buffer_signal_group = tepl_signal_group_new (G_OBJECT (buffer)); tepl_signal_group_add (indicator->priv->buffer_signal_group, g_signal_connect (buffer, "tepl-cursor-moved", G_CALLBACK (cursor_moved_cb), indicator)); } static void buffer_notify_cb (TeplView *view, GParamSpec *pspec, TeplLineColumnIndicator *indicator) { TeplBuffer *buffer; buffer = TEPL_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); connect_to_buffer (indicator, buffer); update_cursor_position (indicator); } static void tab_width_notify_cb (TeplView *view, GParamSpec *pspec, TeplLineColumnIndicator *indicator) { /* gtk_source_view_get_visual_column() depends on tab-width. */ update_cursor_position (indicator); } static void connect_to_view (TeplLineColumnIndicator *indicator, TeplView *view) { tepl_signal_group_clear (&indicator->priv->view_signal_group); if (view == NULL) { return; } indicator->priv->view_signal_group = tepl_signal_group_new (G_OBJECT (view)); tepl_signal_group_add (indicator->priv->view_signal_group, g_signal_connect (view, "notify::buffer", G_CALLBACK (buffer_notify_cb), indicator)); tepl_signal_group_add (indicator->priv->view_signal_group, g_signal_connect (view, "notify::tab-width", G_CALLBACK (tab_width_notify_cb), indicator)); } static void view_changed (TeplLineColumnIndicator *indicator) { TeplView *view; TeplBuffer *buffer = NULL; view = get_view (indicator); if (view != NULL) { buffer = TEPL_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); } connect_to_view (indicator, view); connect_to_buffer (indicator, buffer); update_cursor_position (indicator); } /** * tepl_line_column_indicator_set_view: * @indicator: a #TeplLineColumnIndicator. * @view: (nullable): a #TeplView, or %NULL. * * Sets a #TeplView to update automatically the values for the line and column * of the current cursor position. If @view is %NULL, then @indicator will be * empty. * * Use tepl_line_column_indicator_set_view() or * tepl_line_column_indicator_set_tab_group(), but not both. * * Since: 6.4 */ void tepl_line_column_indicator_set_view (TeplLineColumnIndicator *indicator, TeplView *view) { g_return_if_fail (TEPL_IS_LINE_COLUMN_INDICATOR (indicator)); g_return_if_fail (view == NULL || TEPL_IS_VIEW (view)); g_return_if_fail (indicator->priv->tab_group == NULL); tepl_utils_set_widget ((GtkWidget **) &indicator->priv->view, (GtkWidget *) view); view_changed (indicator); } static void active_view_notify_cb (TeplTabGroup *tab_group, GParamSpec *pspec, TeplLineColumnIndicator *indicator) { view_changed (indicator); } /** * tepl_line_column_indicator_set_tab_group: * @indicator: a #TeplLineColumnIndicator. * @tab_group: a #TeplTabGroup. * * Sets a #TeplTabGroup to update automatically the values for the line and * column of the current cursor position, for the current * #TeplTabGroup:active-tab. * * This function can be called only once per @indicator. * * Use tepl_line_column_indicator_set_view() or * tepl_line_column_indicator_set_tab_group(), but not both. * * Since: 6.4 */ void tepl_line_column_indicator_set_tab_group (TeplLineColumnIndicator *indicator, TeplTabGroup *tab_group) { g_return_if_fail (TEPL_IS_LINE_COLUMN_INDICATOR (indicator)); g_return_if_fail (TEPL_IS_TAB_GROUP (tab_group)); g_return_if_fail (indicator->priv->tab_group == NULL); g_return_if_fail (indicator->priv->view == NULL); indicator->priv->tab_group = g_object_ref_sink (tab_group); g_signal_connect_object (tab_group, "notify::active-view", G_CALLBACK (active_view_notify_cb), indicator, 0); view_changed (indicator); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-line-column-indicator.h000066400000000000000000000040261526404732400304710ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_LINE_COLUMN_INDICATOR_H #define TEPL_LINE_COLUMN_INDICATOR_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_LINE_COLUMN_INDICATOR (tepl_line_column_indicator_get_type ()) #define TEPL_LINE_COLUMN_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_LINE_COLUMN_INDICATOR, TeplLineColumnIndicator)) #define TEPL_LINE_COLUMN_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_LINE_COLUMN_INDICATOR, TeplLineColumnIndicatorClass)) #define TEPL_IS_LINE_COLUMN_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_LINE_COLUMN_INDICATOR)) #define TEPL_IS_LINE_COLUMN_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_LINE_COLUMN_INDICATOR)) #define TEPL_LINE_COLUMN_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_LINE_COLUMN_INDICATOR, TeplLineColumnIndicatorClass)) typedef struct _TeplLineColumnIndicator TeplLineColumnIndicator; typedef struct _TeplLineColumnIndicatorClass TeplLineColumnIndicatorClass; typedef struct _TeplLineColumnIndicatorPrivate TeplLineColumnIndicatorPrivate; struct _TeplLineColumnIndicator { GtkBin parent; TeplLineColumnIndicatorPrivate *priv; }; struct _TeplLineColumnIndicatorClass { GtkBinClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_line_column_indicator_get_type (void); G_MODULE_EXPORT TeplLineColumnIndicator * tepl_line_column_indicator_new (void); G_MODULE_EXPORT void tepl_line_column_indicator_set_view (TeplLineColumnIndicator *indicator, TeplView *view); G_MODULE_EXPORT void tepl_line_column_indicator_set_tab_group (TeplLineColumnIndicator *indicator, TeplTabGroup *tab_group); G_END_DECLS #endif /* TEPL_LINE_COLUMN_INDICATOR_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-menu-shell.c000066400000000000000000000030771526404732400263460ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-menu-shell.h" #include /** * SECTION:menu-shell * @Short_description: #GtkMenuShell functions * @Title: TeplMenuShell * * #GtkMenuShell functions. */ /** * tepl_menu_shell_append_edit_actions: * @menu_shell: a #GtkMenuShell. * * Appends #GtkMenuItem's to @menu_shell for the following #GAction's: * - `"win.tepl-cut"` * - `"win.tepl-copy"` * - `"win.tepl-paste"` * - `"win.tepl-delete"` * - `"win.tepl-select-all"` * * See the [list of GActions implemented in * TeplApplicationWindow][tepl-application-window-gactions]. This function * correctly uses the %AMTK_FACTORY_IGNORE_ACCELS_FOR_APP flag to create the * #GtkMenuItem's. * * Since: 3.0 */ void tepl_menu_shell_append_edit_actions (GtkMenuShell *menu_shell) { AmtkFactory *factory; g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell)); factory = amtk_factory_new (NULL); amtk_factory_set_default_flags (factory, AMTK_FACTORY_IGNORE_ACCELS_FOR_APP); gtk_menu_shell_append (menu_shell, amtk_factory_create_menu_item (factory, "win.tepl-cut")); gtk_menu_shell_append (menu_shell, amtk_factory_create_menu_item (factory, "win.tepl-copy")); gtk_menu_shell_append (menu_shell, amtk_factory_create_menu_item (factory, "win.tepl-paste")); gtk_menu_shell_append (menu_shell, amtk_factory_create_menu_item (factory, "win.tepl-delete")); gtk_menu_shell_append (menu_shell, amtk_factory_create_menu_item (factory, "win.tepl-select-all")); g_object_unref (factory); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-menu-shell.h000066400000000000000000000007211526404732400263440ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_MENU_SHELL_H #define TEPL_MENU_SHELL_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT void tepl_menu_shell_append_edit_actions (GtkMenuShell *menu_shell); G_END_DECLS #endif /* TEPL_MENU_SHELL_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata-attic.c000066400000000000000000000130311526404732400271460ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-metadata-attic.h" #include "tepl-utils.h" /* Some metadata put into the attic. */ struct _TeplMetadataAtticPrivate { /* Keys: not nullable gchar * * Values: not nullable gchar * * hash_table never NULL. * * Note that unlike TeplMetadata, here the values must never be NULL. */ GHashTable *hash_table; /* Time of last access in milliseconds since January 1, 1970 UTC. * Useful for tepl_metadata_manager_trim(). */ gint64 atime; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplMetadataAttic, _tepl_metadata_attic, G_TYPE_OBJECT) static void set_current_atime (TeplMetadataAttic *metadata) { metadata->priv->atime = g_get_real_time () / 1000; } static void _tepl_metadata_attic_finalize (GObject *object) { TeplMetadataAttic *metadata = TEPL_METADATA_ATTIC (object); g_hash_table_unref (metadata->priv->hash_table); G_OBJECT_CLASS (_tepl_metadata_attic_parent_class)->finalize (object); } static void _tepl_metadata_attic_class_init (TeplMetadataAtticClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = _tepl_metadata_attic_finalize; } static void _tepl_metadata_attic_init (TeplMetadataAttic *metadata) { metadata->priv = _tepl_metadata_attic_get_instance_private (metadata); metadata->priv->hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } TeplMetadataAttic * _tepl_metadata_attic_new (void) { return g_object_new (TEPL_TYPE_METADATA_ATTIC, NULL); } /* Returns: TRUE on success. */ gboolean _tepl_metadata_attic_set_atime_str (TeplMetadataAttic *metadata, const gchar *atime_str) { g_return_val_if_fail (TEPL_IS_METADATA_ATTIC (metadata), FALSE); g_return_val_if_fail (atime_str != NULL, FALSE); return g_ascii_string_to_signed (atime_str, 10, 0, G_MAXINT64, &metadata->priv->atime, NULL); } /* See GCompareFunc. */ gint _tepl_metadata_attic_compare_atime (TeplMetadataAttic *metadata1, TeplMetadataAttic *metadata2) { g_return_val_if_fail (TEPL_IS_METADATA_ATTIC (metadata1), 0); g_return_val_if_fail (TEPL_IS_METADATA_ATTIC (metadata2), 0); if (metadata1->priv->atime < metadata2->priv->atime) { return -1; } else if (metadata1->priv->atime > metadata2->priv->atime) { return 1; } return 0; } void _tepl_metadata_attic_insert_entry (TeplMetadataAttic *metadata, const gchar *key, const gchar *value) { g_return_if_fail (TEPL_IS_METADATA_ATTIC (metadata)); g_return_if_fail (_tepl_metadata_key_is_valid (key)); g_return_if_fail (_tepl_metadata_value_is_valid (value)); g_hash_table_replace (metadata->priv->hash_table, g_strdup (key), g_strdup (value)); } static void append_entries_to_string (TeplMetadataAttic *metadata, GString *string) { GHashTableIter iter; gpointer key_p; gpointer value_p; g_hash_table_iter_init (&iter, metadata->priv->hash_table); while (g_hash_table_iter_next (&iter, &key_p, &value_p)) { const gchar *key = key_p; const gchar *value = value_p; gchar *value_escaped; /* No need to escape the key. */ value_escaped = tepl_utils_markup_escape_text (value); g_string_append_printf (string, " \n", key, value_escaped); g_free (value_escaped); } } void _tepl_metadata_attic_append_xml_to_string (TeplMetadataAttic *metadata, GFile *location, GString *string) { gchar *uri; gchar *uri_escaped; g_return_if_fail (TEPL_IS_METADATA_ATTIC (metadata)); g_return_if_fail (G_IS_FILE (location)); g_return_if_fail (string != NULL); if (g_hash_table_size (metadata->priv->hash_table) == 0) { return; } uri = g_file_get_uri (location); uri_escaped = tepl_utils_markup_escape_text (uri); g_string_append_printf (string, " \n", uri_escaped, metadata->priv->atime); append_entries_to_string (metadata, string); g_string_append (string, " \n"); g_free (uri); g_free (uri_escaped); } void _tepl_metadata_attic_copy_from (TeplMetadataAttic *from_metadata_attic, TeplMetadata *to_metadata) { GHashTableIter iter; gpointer key_p; gpointer value_p; g_return_if_fail (TEPL_IS_METADATA_ATTIC (from_metadata_attic)); g_return_if_fail (TEPL_IS_METADATA (to_metadata)); g_hash_table_iter_init (&iter, from_metadata_attic->priv->hash_table); while (g_hash_table_iter_next (&iter, &key_p, &value_p)) { const gchar *key = key_p; const gchar *value = value_p; tepl_metadata_set (to_metadata, key, value); } set_current_atime (from_metadata_attic); } static void merge_into__from_metadata_foreach_cb (gpointer key_p, gpointer value_p, gpointer user_data) { const gchar *key = key_p; const gchar *value = value_p; /* Can be NULL. */ TeplMetadataAttic *into_metadata_attic = TEPL_METADATA_ATTIC (user_data); if (value != NULL) { _tepl_metadata_attic_insert_entry (into_metadata_attic, key, value); } else { /* Unset. */ g_hash_table_remove (into_metadata_attic->priv->hash_table, key); } } void _tepl_metadata_attic_merge_into (TeplMetadataAttic *into_metadata_attic, TeplMetadata *from_metadata) { g_return_if_fail (TEPL_IS_METADATA_ATTIC (into_metadata_attic)); g_return_if_fail (TEPL_IS_METADATA (from_metadata)); _tepl_metadata_foreach (from_metadata, merge_into__from_metadata_foreach_cb, into_metadata_attic); set_current_atime (into_metadata_attic); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata-attic.h000066400000000000000000000044521526404732400271620ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_METADATA_ATTIC_H #define TEPL_METADATA_ATTIC_H #include #include "tepl-metadata.h" G_BEGIN_DECLS #define TEPL_TYPE_METADATA_ATTIC (_tepl_metadata_attic_get_type ()) #define TEPL_METADATA_ATTIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_METADATA_ATTIC, TeplMetadataAttic)) #define TEPL_METADATA_ATTIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_METADATA_ATTIC, TeplMetadataAtticClass)) #define TEPL_IS_METADATA_ATTIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_METADATA_ATTIC)) #define TEPL_IS_METADATA_ATTIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_METADATA_ATTIC)) #define TEPL_METADATA_ATTIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_METADATA_ATTIC, TeplMetadataAtticClass)) typedef struct _TeplMetadataAttic TeplMetadataAttic; typedef struct _TeplMetadataAtticClass TeplMetadataAtticClass; typedef struct _TeplMetadataAtticPrivate TeplMetadataAtticPrivate; struct _TeplMetadataAttic { GObject parent; TeplMetadataAtticPrivate *priv; }; struct _TeplMetadataAtticClass { GObjectClass parent_class; }; G_GNUC_INTERNAL GType _tepl_metadata_attic_get_type (void); G_GNUC_INTERNAL TeplMetadataAttic * _tepl_metadata_attic_new (void); G_GNUC_INTERNAL gboolean _tepl_metadata_attic_set_atime_str (TeplMetadataAttic *metadata, const gchar *atime_str); G_GNUC_INTERNAL gint _tepl_metadata_attic_compare_atime (TeplMetadataAttic *metadata1, TeplMetadataAttic *metadata2); G_GNUC_INTERNAL void _tepl_metadata_attic_insert_entry (TeplMetadataAttic *metadata, const gchar *key, const gchar *value); G_GNUC_INTERNAL void _tepl_metadata_attic_append_xml_to_string (TeplMetadataAttic *metadata, GFile *location, GString *string); G_GNUC_INTERNAL void _tepl_metadata_attic_copy_from (TeplMetadataAttic *from_metadata_attic, TeplMetadata *to_metadata); G_GNUC_INTERNAL void _tepl_metadata_attic_merge_into (TeplMetadataAttic *into_metadata_attic, TeplMetadata *from_metadata); G_END_DECLS #endif /* TEPL_METADATA_ATTIC_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata-manager.c000066400000000000000000000252401526404732400274610ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-metadata-manager.h" #include "tepl-metadata-attic.h" #include "tepl-metadata-parser.h" #include "tepl-utils.h" /** * SECTION:metadata-manager * @Title: TeplMetadataManager * @Short_description: To store file metadata on disk * * #TeplMetadataManager permits to store file metadata on disk. It serves both * as an easier replacement for GVfs metadata, and to have metadata support on * platforms that don't support GVfs metadata. * * For the #GFile where the metadata are stored (see the * tepl_metadata_manager_load_from_disk() and * tepl_metadata_manager_save_to_disk() functions), the following applies: * - A good place to store the metadata is in a sub-directory of the user data * directory. See g_get_user_data_dir(). * - The #GFile must be different for each process. It is advised for your * application to rely on #GApplication process uniqueness. * #TeplMetadataManager doesn't support concurrent accesses to the same #GFile * from different processes. Which means that metadata cannot be shared * between applications. * * # High-level API * * #TeplMetadataManager and #TeplMetadata are integrated in the Tepl framework, * see: * - tepl_application_handle_metadata(). * - the metadata API of #TeplBuffer. */ /* This code is a modified version of GeditMetadataManager, coming from gedit: * * SPDX-FileCopyrightText: 2003-2007 - Paolo Maggi * * The XML format is the same. TeplMetadataManager can read a file generated by * GeditMetadataManager; but the reverse is maybe not true, it hasn't been * tested. * * A better implementation would be to use a database, so that several processes * can read and write to it at the same time, to be able to share metadata * between apps. */ struct _TeplMetadataManagerPrivate { /* Keys: GFile * * Values: TeplMetadataAttic * * Never NULL. */ GHashTable *hash_table; guint modified : 1; }; /* TeplMetadataManager is a singleton. */ static TeplMetadataManager *singleton = NULL; #define DEFAULT_MAX_NUMBER_OF_LOCATIONS (1000) G_DEFINE_TYPE_WITH_PRIVATE (TeplMetadataManager, tepl_metadata_manager, G_TYPE_OBJECT) static void tepl_metadata_manager_finalize (GObject *object) { TeplMetadataManager *manager = TEPL_METADATA_MANAGER (object); if (singleton == manager) { singleton = NULL; } g_hash_table_unref (manager->priv->hash_table); G_OBJECT_CLASS (tepl_metadata_manager_parent_class)->finalize (object); } static void tepl_metadata_manager_class_init (TeplMetadataManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = tepl_metadata_manager_finalize; } static void tepl_metadata_manager_init (TeplMetadataManager *manager) { manager->priv = tepl_metadata_manager_get_instance_private (manager); manager->priv->hash_table = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, g_object_unref); } /** * tepl_metadata_manager_get_singleton: * * Returns: (transfer none): the #TeplMetadataManager singleton instance. * Since: 5.0 */ TeplMetadataManager * tepl_metadata_manager_get_singleton (void) { if (singleton == NULL) { singleton = g_object_new (TEPL_TYPE_METADATA_MANAGER, NULL); } return singleton; } void _tepl_metadata_manager_unref_singleton (void) { if (singleton != NULL) { g_object_unref (singleton); } /* singleton is not set to NULL here, it is set to NULL in * tepl_metadata_manager_finalize() (i.e. when we are sure that the ref * count reaches 0). */ } /** * tepl_metadata_manager_trim: * @manager: the #TeplMetadataManager. * @max_number_of_locations: the maximum size, or -1 for the default value. * * The purpose of having a maximum size is to avoid that the file on disk grows * indefinitely. * * @max_number_of_locations is the maximum number of #GFile locations for which * metadata are kept. This function discards the least recently accessed * metadata if needed. * * If @max_number_of_locations is -1, a default internal value is used that * should fit most applications' needs. * * Since: 5.0 */ void tepl_metadata_manager_trim (TeplMetadataManager *manager, gint max_number_of_locations) { guint my_max_number_of_locations; g_return_if_fail (TEPL_IS_METADATA_MANAGER (manager)); g_return_if_fail (max_number_of_locations >= -1); if (max_number_of_locations == -1) { my_max_number_of_locations = DEFAULT_MAX_NUMBER_OF_LOCATIONS; } else { my_max_number_of_locations = max_number_of_locations; } while (g_hash_table_size (manager->priv->hash_table) > my_max_number_of_locations) { GHashTableIter iter; gpointer key; gpointer value; GFile *oldest_location = NULL; TeplMetadataAttic *oldest_metadata_attic = NULL; g_hash_table_iter_init (&iter, manager->priv->hash_table); while (g_hash_table_iter_next (&iter, &key, &value)) { GFile *location = key; TeplMetadataAttic *metadata_attic = value; if (oldest_location == NULL || _tepl_metadata_attic_compare_atime (metadata_attic, oldest_metadata_attic) < 0) { oldest_location = location; oldest_metadata_attic = metadata_attic; } } g_hash_table_remove (manager->priv->hash_table, oldest_location); manager->priv->modified = TRUE; } } /** * tepl_metadata_manager_load_from_disk: * @manager: the #TeplMetadataManager. * @from_file: the #GFile to load metadata from. * @error: location to a %NULL #GError, or %NULL. * * Loads synchronously all the metadata from @from_file into @manager. * * A good moment to call this function is on application startup, see the * #GApplication::startup signal. * * Returns: whether the operation was successful. * Since: 5.0 */ gboolean tepl_metadata_manager_load_from_disk (TeplMetadataManager *manager, GFile *from_file, GError **error) { g_return_val_if_fail (TEPL_IS_METADATA_MANAGER (manager), FALSE); g_return_val_if_fail (G_IS_FILE (from_file), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); return _tepl_metadata_parser_read_file (from_file, manager->priv->hash_table, error); } static GBytes * to_string (TeplMetadataManager *manager) { GString *string; GHashTableIter iter; gpointer key; gpointer value; string = g_string_new (NULL); g_string_append (string, "\n"); g_hash_table_iter_init (&iter, manager->priv->hash_table); while (g_hash_table_iter_next (&iter, &key, &value)) { GFile *location = key; TeplMetadataAttic *metadata_attic = value; _tepl_metadata_attic_append_xml_to_string (metadata_attic, location, string); } g_string_append (string, "\n"); return g_string_free_to_bytes (string); } /** * tepl_metadata_manager_save_to_disk: * @manager: the #TeplMetadataManager. * @to_file: the #GFile to save metadata to. * @trim: if %TRUE, tepl_metadata_manager_trim() is called with -1. * @error: location to a %NULL #GError, or %NULL. * * Saves synchronously all the metadata from @manager to @to_file. The parent * directories of @to_file are created if needed. * * A good moment to call this function is on application shutdown, see the * #GApplication::shutdown signal. * * Returns: whether the operation was successful. * Since: 5.0 */ gboolean tepl_metadata_manager_save_to_disk (TeplMetadataManager *manager, GFile *to_file, gboolean trim, GError **error) { GBytes *bytes; gboolean ok; g_return_val_if_fail (TEPL_IS_METADATA_MANAGER (manager), FALSE); g_return_val_if_fail (G_IS_FILE (to_file), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); if (trim) { tepl_metadata_manager_trim (manager, -1); } if (!manager->priv->modified) { return TRUE; } if (!tepl_utils_create_parent_directories (to_file, NULL, error)) { return FALSE; } bytes = to_string (manager); ok = g_file_replace_contents (to_file, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL, error); if (ok) { manager->priv->modified = FALSE; } g_bytes_unref (bytes); return ok; } /** * tepl_metadata_manager_copy_from: * @from_manager: the #TeplMetadataManager. * @for_location: a #GFile. * @to_metadata: a #TeplMetadata. * * Copies the metadata stored in @from_manager for @for_location into * @to_metadata. * * If @to_metadata already contains a key that is also present in @from_manager, * the value in @to_metadata is overwritten. * * If @to_metadata already contains a key that is not present in @from_manager, * the key/value pair is kept in @to_metadata, it is not erased. * * Since: 5.0 */ void tepl_metadata_manager_copy_from (TeplMetadataManager *from_manager, GFile *for_location, TeplMetadata *to_metadata) { TeplMetadataAttic *from_metadata_attic; g_return_if_fail (TEPL_IS_METADATA_MANAGER (from_manager)); g_return_if_fail (G_IS_FILE (for_location)); g_return_if_fail (TEPL_IS_METADATA (to_metadata)); from_metadata_attic = g_hash_table_lookup (from_manager->priv->hash_table, for_location); if (from_metadata_attic != NULL) { _tepl_metadata_attic_copy_from (from_metadata_attic, to_metadata); } } /** * tepl_metadata_manager_merge_into: * @into_manager: the #TeplMetadataManager. * @for_location: a #GFile. * @from_metadata: a #TeplMetadata. * * Merges the metadata from @from_metadata into @into_manager for @for_location. * * If a key from @from_metadata has been set to %NULL, the key/value pair is * removed from @into_manager. In other words that key/value pair will not be * saved at all when calling tepl_metadata_manager_save_to_disk(). * * If @into_manager already contains a key that is not present in * @from_metadata, the key/value pair is kept in @into_manager, it is not * erased. * * Since: 5.0 */ void tepl_metadata_manager_merge_into (TeplMetadataManager *into_manager, GFile *for_location, TeplMetadata *from_metadata) { TeplMetadataAttic *into_metadata_attic; g_return_if_fail (TEPL_IS_METADATA_MANAGER (into_manager)); g_return_if_fail (G_IS_FILE (for_location)); g_return_if_fail (TEPL_IS_METADATA (from_metadata)); into_metadata_attic = g_hash_table_lookup (into_manager->priv->hash_table, for_location); if (into_metadata_attic == NULL) { into_metadata_attic = _tepl_metadata_attic_new (); g_hash_table_replace (into_manager->priv->hash_table, g_object_ref (for_location), into_metadata_attic); } _tepl_metadata_attic_merge_into (into_metadata_attic, from_metadata); into_manager->priv->modified = TRUE; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata-manager.h000066400000000000000000000051161526404732400274660ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_METADATA_MANAGER_H #define TEPL_METADATA_MANAGER_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS #define TEPL_TYPE_METADATA_MANAGER (tepl_metadata_manager_get_type ()) #define TEPL_METADATA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_METADATA_MANAGER, TeplMetadataManager)) #define TEPL_METADATA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_METADATA_MANAGER, TeplMetadataManagerClass)) #define TEPL_IS_METADATA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_METADATA_MANAGER)) #define TEPL_IS_METADATA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_METADATA_MANAGER)) #define TEPL_METADATA_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_METADATA_MANAGER, TeplMetadataManagerClass)) typedef struct _TeplMetadataManager TeplMetadataManager; typedef struct _TeplMetadataManagerClass TeplMetadataManagerClass; typedef struct _TeplMetadataManagerPrivate TeplMetadataManagerPrivate; struct _TeplMetadataManager { GObject parent; TeplMetadataManagerPrivate *priv; }; struct _TeplMetadataManagerClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_metadata_manager_get_type (void); G_MODULE_EXPORT TeplMetadataManager * tepl_metadata_manager_get_singleton (void); G_GNUC_INTERNAL void _tepl_metadata_manager_unref_singleton (void); G_MODULE_EXPORT void tepl_metadata_manager_trim (TeplMetadataManager *manager, gint max_number_of_locations); G_MODULE_EXPORT gboolean tepl_metadata_manager_load_from_disk (TeplMetadataManager *manager, GFile *from_file, GError **error); G_MODULE_EXPORT gboolean tepl_metadata_manager_save_to_disk (TeplMetadataManager *manager, GFile *to_file, gboolean trim, GError **error); G_MODULE_EXPORT void tepl_metadata_manager_copy_from (TeplMetadataManager *from_manager, GFile *for_location, TeplMetadata *to_metadata); G_MODULE_EXPORT void tepl_metadata_manager_merge_into (TeplMetadataManager *into_manager, GFile *for_location, TeplMetadata *from_metadata); G_END_DECLS #endif /* TEPL_METADATA_MANAGER_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata-parser.c000066400000000000000000000223301526404732400273400ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-metadata-parser.h" #include #include "tepl-metadata-attic.h" typedef struct _ParsingData ParsingData; struct _ParsingData { GHashTable *hash_table; gchar *cur_document_uri; TeplMetadataAttic *cur_metadata_attic; guint metadata_element_open : 1; guint document_element_open : 1; }; static ParsingData * parsing_data_new (GHashTable *hash_table) { ParsingData *parsing_data; parsing_data = g_new0 (ParsingData, 1); parsing_data->hash_table = g_hash_table_ref (hash_table); return parsing_data; } static void parsing_data_check_invariants (ParsingData *parsing_data) { if (!parsing_data->metadata_element_open) { g_assert (!parsing_data->document_element_open); g_assert (parsing_data->cur_document_uri == NULL); g_assert (parsing_data->cur_metadata_attic == NULL); return; } if (!parsing_data->document_element_open) { g_assert (parsing_data->cur_document_uri == NULL); g_assert (parsing_data->cur_metadata_attic == NULL); return; } g_assert (parsing_data->cur_document_uri != NULL); g_assert (parsing_data->cur_metadata_attic != NULL); } static void parsing_data_free (ParsingData *parsing_data) { if (parsing_data != NULL) { g_hash_table_unref (parsing_data->hash_table); g_free (parsing_data->cur_document_uri); g_clear_object (&parsing_data->cur_metadata_attic); g_free (parsing_data); } } /* */ static void parse_metadata_element (GMarkupParseContext *context, const gchar *element_name, ParsingData *parsing_data, GError **error) { g_assert (!parsing_data->metadata_element_open); if (!g_str_equal (element_name, "metadata")) { g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, /* Translators: do not translate . */ _("The XML file must start with a element, not “%s”."), element_name); return; } parsing_data->metadata_element_open = TRUE; } /* */ static void parse_document_element (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, ParsingData *parsing_data, GError **error) { gboolean got_uri = FALSE; gboolean got_atime = FALSE; gint attr_num; g_assert (parsing_data->metadata_element_open); g_assert (!parsing_data->document_element_open); g_assert (parsing_data->cur_document_uri == NULL); g_assert (parsing_data->cur_metadata_attic == NULL); if (!g_str_equal (element_name, "document")) { g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, /* Translators: do not translate . */ _("Expected a element, got “%s” instead."), element_name); return; } parsing_data->cur_metadata_attic = _tepl_metadata_attic_new (); for (attr_num = 0; attribute_names[attr_num] != NULL; attr_num++) { const gchar *cur_attr_name = attribute_names[attr_num]; const gchar *cur_attr_value = attribute_values[attr_num]; if (!got_uri && g_str_equal (cur_attr_name, "uri")) { parsing_data->cur_document_uri = g_strdup (cur_attr_value); got_uri = TRUE; } else if (!got_atime && g_str_equal (cur_attr_name, "atime")) { if (!_tepl_metadata_attic_set_atime_str (parsing_data->cur_metadata_attic, cur_attr_value)) { g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, /* Translators: do not translate “atime”. */ _("Failed to parse the “atime” attribute value “%s”."), cur_attr_value); return; } got_atime = TRUE; } } if (!got_uri || !got_atime) { g_set_error_literal (error, G_MARKUP_ERROR, G_MARKUP_ERROR_MISSING_ATTRIBUTE, /* Translators: do not translate , “uri” and “atime”. */ _("The element must contain the “uri” and “atime” attributes.")); } parsing_data->document_element_open = TRUE; } /* */ static void parse_entry_element (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, ParsingData *parsing_data, GError **error) { const gchar *key = NULL; const gchar *value = NULL; gint attr_num; g_assert (parsing_data->metadata_element_open); g_assert (parsing_data->document_element_open); g_assert (parsing_data->cur_metadata_attic != NULL); if (!g_str_equal (element_name, "entry")) { g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, /* Translators: do not translate . */ _("Expected an element, got “%s” instead."), element_name); return; } for (attr_num = 0; attribute_names[attr_num] != NULL; attr_num++) { const gchar *cur_attr_name = attribute_names[attr_num]; const gchar *cur_attr_value = attribute_values[attr_num]; if (key == NULL && g_str_equal (cur_attr_name, "key")) { key = cur_attr_value; } else if (value == NULL && g_str_equal (cur_attr_name, "value")) { value = cur_attr_value; } } if (key == NULL || value == NULL) { g_set_error_literal (error, G_MARKUP_ERROR, G_MARKUP_ERROR_MISSING_ATTRIBUTE, /* Translators: do not translate , “key” and “value”. */ _("The element is missing the “key” or “value” attribute.")); return; } _tepl_metadata_attic_insert_entry (parsing_data->cur_metadata_attic, key, value); } static void parser_start_element_cb (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error) { ParsingData *parsing_data = user_data; g_return_if_fail (element_name != NULL); parsing_data_check_invariants (parsing_data); /* */ if (!parsing_data->metadata_element_open) { parse_metadata_element (context, element_name, parsing_data, error); return; } /* */ if (!parsing_data->document_element_open) { parse_document_element (context, element_name, attribute_names, attribute_values, parsing_data, error); return; } /* */ parse_entry_element (context, element_name, attribute_names, attribute_values, parsing_data, error); } static void insert_document_to_hash_table (ParsingData *parsing_data) { g_assert (parsing_data->document_element_open); parsing_data_check_invariants (parsing_data); g_hash_table_replace (parsing_data->hash_table, g_file_new_for_uri (parsing_data->cur_document_uri), parsing_data->cur_metadata_attic); g_free (parsing_data->cur_document_uri); parsing_data->cur_document_uri = NULL; parsing_data->cur_metadata_attic = NULL; parsing_data->document_element_open = FALSE; } static void parser_end_element_cb (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error) { ParsingData *parsing_data = user_data; g_return_if_fail (element_name != NULL); /* */ if (g_str_equal (element_name, "document")) { g_return_if_fail (parsing_data->document_element_open); insert_document_to_hash_table (parsing_data); } } static void parse_xml_file_content (GBytes *xml_file_bytes, GHashTable *hash_table, GError **error) { GMarkupParser parser = { parser_start_element_cb, parser_end_element_cb, NULL, NULL, NULL }; GMarkupParseContext *parse_context; ParsingData *parsing_data; gboolean ok; parsing_data = parsing_data_new (hash_table); parse_context = g_markup_parse_context_new (&parser, 0, parsing_data, NULL); ok = g_markup_parse_context_parse (parse_context, g_bytes_get_data (xml_file_bytes, NULL), g_bytes_get_size (xml_file_bytes), error); if (ok) { g_markup_parse_context_end_parse (parse_context, error); } g_markup_parse_context_free (parse_context); parsing_data_free (parsing_data); } gboolean _tepl_metadata_parser_read_file (GFile *from_file, GHashTable *hash_table, GError **error) { GBytes *bytes; GError *my_error = NULL; gboolean ok = TRUE; g_return_val_if_fail (G_IS_FILE (from_file), FALSE); g_return_val_if_fail (hash_table != NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); bytes = g_file_load_bytes (from_file, NULL, NULL, &my_error); /* If the XML file has not yet been created, e.g. on the first run of * the application. */ if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { g_clear_error (&my_error); goto out; } if (my_error != NULL) { g_propagate_error (error, my_error); ok = FALSE; goto out; } parse_xml_file_content (bytes, hash_table, &my_error); if (my_error != NULL) { g_propagate_error (error, my_error); ok = FALSE; } out: g_bytes_unref (bytes); return ok; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata-parser.h000066400000000000000000000006421526404732400273470ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_METADATA_PARSER_H #define TEPL_METADATA_PARSER_H #include G_BEGIN_DECLS G_GNUC_INTERNAL gboolean _tepl_metadata_parser_read_file (GFile *from_file, GHashTable *hash_table, GError **error); G_END_DECLS #endif /* TEPL_METADATA_PARSER_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata.c000066400000000000000000000122671526404732400260560ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-metadata.h" /** * SECTION:metadata * @Title: TeplMetadata * @Short_description: File metadata * * A #TeplMetadata object contains a set of file metadata as key/value pairs. * * The tepl_metadata_get() and tepl_metadata_set() functions don't load or save * the metadata on disk, they only access the metadata stored in the * #TeplMetadata object memory. * * #TeplMetadata is intended to be used alongside #TeplMetadataManager to load * and store the metadata on disk. * * # Values requirements * * Values must be nul-terminated UTF-8 strings. * * # Keys requirements # {#tepl-metadata-keys-requirements} * * Keys must be non-empty strings containing only: * - ASCII alphanumeric characters (see g_ascii_isalnum()); * - `'-'` characters (hyphens / minus signs); * - or `'_'` characters (underscores). * * Additionally, it's preferable that keys start with a namespace, to not get * metadata conflicts between the application and libraries. * * Examples of valid metadata keys: * - `"gedit-spell-checking-language"` * - `"gCSVedit_column_delimiter"` * - `"tepl-character-encoding"` */ struct _TeplMetadataPrivate { /* Keys: not nullable gchar * * Values: nullable gchar * * hash_table never NULL. */ GHashTable *hash_table; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplMetadata, tepl_metadata, G_TYPE_OBJECT) static void tepl_metadata_finalize (GObject *object) { TeplMetadata *metadata = TEPL_METADATA (object); g_hash_table_unref (metadata->priv->hash_table); G_OBJECT_CLASS (tepl_metadata_parent_class)->finalize (object); } static void tepl_metadata_class_init (TeplMetadataClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = tepl_metadata_finalize; } static void tepl_metadata_init (TeplMetadata *metadata) { metadata->priv = tepl_metadata_get_instance_private (metadata); metadata->priv->hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } /** * tepl_metadata_new: * * Returns: a new, empty #TeplMetadata object. * Since: 5.0 */ TeplMetadata * tepl_metadata_new (void) { return g_object_new (TEPL_TYPE_METADATA, NULL); } /** * tepl_metadata_get: * @metadata: a #TeplMetadata. * @key: a key. * * Gets the value of a metadata stored in the @metadata object memory. * * @key must follow [the requirements explained in the class * description][tepl-metadata-keys-requirements]. * * Returns: (transfer full) (nullable): the associated value (a UTF-8 string), * or %NULL. Free with g_free() when no longer needed. * Since: 5.0 */ gchar * tepl_metadata_get (TeplMetadata *metadata, const gchar *key) { g_return_val_if_fail (TEPL_IS_METADATA (metadata), NULL); g_return_val_if_fail (_tepl_metadata_key_is_valid (key), NULL); return g_strdup (g_hash_table_lookup (metadata->priv->hash_table, key)); } /** * tepl_metadata_set: * @metadata: a #TeplMetadata. * @key: a key. * @value: (nullable): a nul-terminated UTF-8 string, or %NULL to unset the key. * * Sets or unsets @key. This function just stores the new metadata value in the * @metadata object memory. * * @key must follow [the requirements explained in the class * description][tepl-metadata-keys-requirements]. * * Since: 5.0 */ void tepl_metadata_set (TeplMetadata *metadata, const gchar *key, const gchar *value) { g_return_if_fail (TEPL_IS_METADATA (metadata)); g_return_if_fail (_tepl_metadata_key_is_valid (key)); g_return_if_fail (value == NULL || _tepl_metadata_value_is_valid (value)); g_hash_table_replace (metadata->priv->hash_table, g_strdup (key), g_strdup (value)); } void _tepl_metadata_foreach (TeplMetadata *metadata, GHFunc func, gpointer user_data) { g_return_if_fail (TEPL_IS_METADATA (metadata)); g_hash_table_foreach (metadata->priv->hash_table, func, user_data); } static gboolean key_char_is_valid (gchar ch) { /* The original intention was to use the "metadata" namespace of the * GFileInfo API (to use GVfs metadata). * * At the time of writing this, the GIO API doesn't document the * requirements for valid attribute names. See the docs of * g_file_query_info() for example. Clearly '*' and ',' must not be used * because they serve to query several attributes. ':' is used in "::" * to separate the namespace from the attribute name, I'm not sure that * there can be several nested namespaces like in * "metadata::gCSVedit::delimiter"; in case of doubt it's better not to * support it by not allowing ':'. * * All in all, the following code seems like good requirements even * though GVfs metadata is not used. */ return (g_ascii_isalnum (ch) || ch == '-' || ch == '_'); } gboolean _tepl_metadata_key_is_valid (const gchar *key) { const gchar *p; if (key == NULL || key[0] == '\0') { return FALSE; } for (p = key; *p != '\0'; p++) { gchar cur_char = *p; if (!key_char_is_valid (cur_char)) { return FALSE; } } return TRUE; } gboolean _tepl_metadata_value_is_valid (const gchar *value) { if (value == NULL) { return FALSE; } return g_utf8_validate (value, -1, NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-metadata.h000066400000000000000000000035671526404732400260660ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_METADATA_H #define TEPL_METADATA_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_METADATA (tepl_metadata_get_type ()) #define TEPL_METADATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_METADATA, TeplMetadata)) #define TEPL_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_METADATA, TeplMetadataClass)) #define TEPL_IS_METADATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_METADATA)) #define TEPL_IS_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_METADATA)) #define TEPL_METADATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_METADATA, TeplMetadataClass)) typedef struct _TeplMetadata TeplMetadata; typedef struct _TeplMetadataClass TeplMetadataClass; typedef struct _TeplMetadataPrivate TeplMetadataPrivate; struct _TeplMetadata { GObject parent; TeplMetadataPrivate *priv; }; struct _TeplMetadataClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_metadata_get_type (void); G_MODULE_EXPORT TeplMetadata * tepl_metadata_new (void); G_MODULE_EXPORT gchar * tepl_metadata_get (TeplMetadata *metadata, const gchar *key); G_MODULE_EXPORT void tepl_metadata_set (TeplMetadata *metadata, const gchar *key, const gchar *value); G_GNUC_INTERNAL void _tepl_metadata_foreach (TeplMetadata *metadata, GHFunc func, gpointer user_data); G_GNUC_INTERNAL gboolean _tepl_metadata_key_is_valid (const gchar *key); G_GNUC_INTERNAL gboolean _tepl_metadata_value_is_valid (const gchar *value); G_END_DECLS #endif /* TEPL_METADATA_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-notebook.c000066400000000000000000000173521526404732400261160ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-notebook.h" #include "tepl-abstract-factory.h" #include "tepl-tab-group.h" #include "tepl-tab.h" #include "tepl-signal-group.h" /** * SECTION:notebook * @Short_description: Subclass of #GtkNotebook implementing the #TeplTabGroup * interface * @Title: TeplNotebook * * #TeplNotebook is a subclass of #GtkNotebook that implements the #TeplTabGroup * interface. */ struct _TeplNotebookPrivate { TeplSignalGroup *view_signal_group; /* Not used for tepl_tab_group_get_active_tab(), used to avoid sending * unnecessary notify signals. * Unowned. */ TeplTab *active_tab; }; enum { PROP_0, PROP_ACTIVE_TAB, PROP_ACTIVE_VIEW, PROP_ACTIVE_BUFFER, }; static void tepl_tab_group_interface_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (TeplNotebook, tepl_notebook, GTK_TYPE_NOTEBOOK, G_ADD_PRIVATE (TeplNotebook) G_IMPLEMENT_INTERFACE (TEPL_TYPE_TAB_GROUP, tepl_tab_group_interface_init)) static void tepl_notebook_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplTabGroup *tab_group = TEPL_TAB_GROUP (object); switch (prop_id) { case PROP_ACTIVE_TAB: g_value_set_object (value, tepl_tab_group_get_active_tab (tab_group)); break; case PROP_ACTIVE_VIEW: g_value_set_object (value, tepl_tab_group_get_active_view (tab_group)); break; case PROP_ACTIVE_BUFFER: g_value_set_object (value, tepl_tab_group_get_active_buffer (tab_group)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_notebook_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplTabGroup *tab_group = TEPL_TAB_GROUP (object); switch (prop_id) { case PROP_ACTIVE_TAB: tepl_tab_group_set_active_tab (tab_group, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_notebook_dispose (GObject *object) { TeplNotebook *notebook = TEPL_NOTEBOOK (object); tepl_signal_group_clear (¬ebook->priv->view_signal_group); G_OBJECT_CLASS (tepl_notebook_parent_class)->dispose (object); } static void buffer_notify_cb (GtkTextView *view, GParamSpec *pspec, TeplNotebook *notebook) { g_object_notify (G_OBJECT (notebook), "active-buffer"); } static void check_active_tab_changed (TeplNotebook *notebook) { TeplTab *active_tab; TeplView *active_view; active_tab = tepl_tab_group_get_active_tab (TEPL_TAB_GROUP (notebook)); if (notebook->priv->active_tab == active_tab) { return; } notebook->priv->active_tab = active_tab; tepl_signal_group_clear (¬ebook->priv->view_signal_group); active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (notebook)); if (active_view != NULL) { notebook->priv->view_signal_group = tepl_signal_group_new (G_OBJECT (active_view)); tepl_signal_group_add (notebook->priv->view_signal_group, g_signal_connect (active_view, "notify::buffer", G_CALLBACK (buffer_notify_cb), notebook)); } g_object_notify (G_OBJECT (notebook), "active-tab"); g_object_notify (G_OBJECT (notebook), "active-view"); g_object_notify (G_OBJECT (notebook), "active-buffer"); } static void tepl_notebook_switch_page (GtkNotebook *notebook, GtkWidget *page, guint page_num) { if (GTK_NOTEBOOK_CLASS (tepl_notebook_parent_class)->switch_page != NULL) { GTK_NOTEBOOK_CLASS (tepl_notebook_parent_class)->switch_page (notebook, page, page_num); } check_active_tab_changed (TEPL_NOTEBOOK (notebook)); } static void tepl_notebook_page_removed (GtkNotebook *notebook, GtkWidget *child, guint page_num) { if (GTK_NOTEBOOK_CLASS (tepl_notebook_parent_class)->page_removed != NULL) { GTK_NOTEBOOK_CLASS (tepl_notebook_parent_class)->page_removed (notebook, child, page_num); } check_active_tab_changed (TEPL_NOTEBOOK (notebook)); } static void tepl_notebook_class_init (TeplNotebookClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass); object_class->get_property = tepl_notebook_get_property; object_class->set_property = tepl_notebook_set_property; object_class->dispose = tepl_notebook_dispose; notebook_class->switch_page = tepl_notebook_switch_page; notebook_class->page_removed = tepl_notebook_page_removed; g_object_class_override_property (object_class, PROP_ACTIVE_TAB, "active-tab"); g_object_class_override_property (object_class, PROP_ACTIVE_VIEW, "active-view"); g_object_class_override_property (object_class, PROP_ACTIVE_BUFFER, "active-buffer"); } static GList * tepl_notebook_get_tabs (TeplTabGroup *tab_group) { GtkNotebook *notebook = GTK_NOTEBOOK (tab_group); GList *tabs = NULL; gint n_pages; gint page_num; n_pages = gtk_notebook_get_n_pages (notebook); for (page_num = n_pages - 1; page_num >= 0; page_num--) { GtkWidget *page_widget; page_widget = gtk_notebook_get_nth_page (notebook, page_num); if (TEPL_IS_TAB (page_widget)) { tabs = g_list_prepend (tabs, TEPL_TAB (page_widget)); } } return tabs; } static TeplTab * tepl_notebook_get_active_tab (TeplTabGroup *tab_group) { GtkNotebook *notebook = GTK_NOTEBOOK (tab_group); gint cur_page_num; GtkWidget *cur_page_widget; cur_page_num = gtk_notebook_get_current_page (notebook); if (cur_page_num == -1) { return NULL; } cur_page_widget = gtk_notebook_get_nth_page (notebook, cur_page_num); return TEPL_IS_TAB (cur_page_widget) ? TEPL_TAB (cur_page_widget) : NULL; } static void tepl_notebook_set_active_tab (TeplTabGroup *tab_group, TeplTab *tab) { GtkNotebook *notebook = GTK_NOTEBOOK (tab_group); gint page_num; page_num = gtk_notebook_page_num (notebook, GTK_WIDGET (tab)); g_return_if_fail (page_num != -1); if (!gtk_widget_get_visible (GTK_WIDGET (tab))) { g_warning ("Calling gtk_notebook_set_current_page() on an " "invisible TeplTab. This won't work, make the " "TeplTab visible first."); } gtk_notebook_set_current_page (notebook, page_num); } static void tepl_notebook_append_tab_vfunc (TeplTabGroup *tab_group, TeplTab *tab) { GtkNotebook *notebook = GTK_NOTEBOOK (tab_group); TeplAbstractFactory *factory; GtkWidget *tab_label; factory = tepl_abstract_factory_get_singleton (); tab_label = tepl_abstract_factory_create_tab_label (factory, tab); gtk_notebook_append_page (notebook, GTK_WIDGET (tab), tab_label); } static void tepl_tab_group_interface_init (gpointer g_iface, gpointer iface_data) { TeplTabGroupInterface *interface = g_iface; interface->get_tabs = tepl_notebook_get_tabs; interface->get_active_tab = tepl_notebook_get_active_tab; interface->set_active_tab = tepl_notebook_set_active_tab; interface->append_tab_vfunc = tepl_notebook_append_tab_vfunc; } static void tepl_notebook_init (TeplNotebook *notebook) { notebook->priv = tepl_notebook_get_instance_private (notebook); /* The statusbar must always be at the bottom of the window (if there is * a statusbar). More generally, the notebook is the main part of the * window, so it needs to be expanded, to push other widgets on the * sides, even if the notebook is empty. */ gtk_widget_set_hexpand (GTK_WIDGET (notebook), TRUE); gtk_widget_set_vexpand (GTK_WIDGET (notebook), TRUE); gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); } /** * tepl_notebook_new: * * Returns: (transfer floating): a new #TeplNotebook. * Since: 3.0 */ GtkWidget * tepl_notebook_new (void) { return g_object_new (TEPL_TYPE_NOTEBOOK, NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-notebook.h000066400000000000000000000026031526404732400261140ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_NOTEBOOK_H #define TEPL_NOTEBOOK_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_NOTEBOOK (tepl_notebook_get_type ()) #define TEPL_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_NOTEBOOK, TeplNotebook)) #define TEPL_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_NOTEBOOK, TeplNotebookClass)) #define TEPL_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_NOTEBOOK)) #define TEPL_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_NOTEBOOK)) #define TEPL_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_NOTEBOOK, TeplNotebookClass)) typedef struct _TeplNotebook TeplNotebook; typedef struct _TeplNotebookClass TeplNotebookClass; typedef struct _TeplNotebookPrivate TeplNotebookPrivate; struct _TeplNotebook { GtkNotebook parent; TeplNotebookPrivate *priv; }; struct _TeplNotebookClass { GtkNotebookClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_notebook_get_type (void); G_MODULE_EXPORT GtkWidget * tepl_notebook_new (void); G_END_DECLS #endif /* TEPL_NOTEBOOK_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-object-counters.c000066400000000000000000000060441526404732400274000ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-object-counters.h" /** * SECTION:object-counters * @Title: TeplObjectCounters * @Short_description: Utility to detect memory leaks * * TeplObjectCounters is a utility to detect memory leaks, by counting the * number of objects constructed and destructed, per type. * * It must be used manually by calling its functions explicitly. * * It is not intended to be used in performance-sensitive code areas. */ /* Keys: owned gchar* (the type as a string). * Values: owned gint* (pointer to the counter). */ static GHashTable *hash_table; /** * tepl_object_counters_init: * * Must be called before using the other TeplObjectCounters functions, usually * early in the `main()` function. * * Since: 6.10 */ void tepl_object_counters_init (void) { if (hash_table == NULL) { hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } } /** * tepl_object_counters_increment: * @type: the object type, as a string. * * Increments the counter for @type. * * For a #GObject class, this function must be called in the `_init()` function, * when an instance is created. * * Since: 6.10 */ void tepl_object_counters_increment (const gchar *type) { gint *counter; g_return_if_fail (type != NULL); g_return_if_fail (hash_table != NULL); counter = g_hash_table_lookup (hash_table, type); if (counter == NULL) { counter = g_malloc (sizeof (gint)); *counter = 1; g_hash_table_insert (hash_table, g_strdup (type), counter); } else { *counter = *counter + 1; } } /** * tepl_object_counters_decrement: * @type: the object type, as a string. * * Decrements the counter for @type. * * For a #GObject class, this function must be called in the `_finalize()` * destructor function. * * Since: 6.10 */ void tepl_object_counters_decrement (const gchar *type) { gint *counter; g_return_if_fail (type != NULL); g_return_if_fail (hash_table != NULL); counter = g_hash_table_lookup (hash_table, type); g_return_if_fail (counter != NULL); g_return_if_fail (*counter > 0); *counter = *counter - 1; } static void final_check (gpointer key, gpointer value, gpointer user_data) { const gchar *type = key; const gint *counter = value; g_return_if_fail (type != NULL); g_return_if_fail (counter != NULL); if (*counter != 0) { g_printerr ("%s: %d remaining instance(s).\n", type, *counter); } } /** * tepl_object_counters_final_check: * * Prints a warning for each type for which the counter hasn't reached zero. * * This function is intended to be called once, towards the end of the `main()` * function. * * After calling this function, the other TeplObjectCounters functions must not * be called anymore. * * Since: 6.10 */ void tepl_object_counters_final_check (void) { g_return_if_fail (hash_table != NULL); g_hash_table_foreach (hash_table, final_check, NULL); g_hash_table_unref (hash_table); hash_table = NULL; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-object-counters.h000066400000000000000000000012041526404732400273760ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_OBJECT_COUNTERS_H #define TEPL_OBJECT_COUNTERS_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT void tepl_object_counters_init (void); G_MODULE_EXPORT void tepl_object_counters_increment (const gchar *type); G_MODULE_EXPORT void tepl_object_counters_decrement (const gchar *type); G_MODULE_EXPORT void tepl_object_counters_final_check (void); G_END_DECLS #endif /* TEPL_OBJECT_COUNTERS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-overwrite-indicator.c000066400000000000000000000213461526404732400302740ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-overwrite-indicator.h" #include #include "tepl-signal-group.h" #include "tepl-utils.h" /** * SECTION:overwrite-indicator * @Short_description: Indicates Insert or Overwrite mode for text edition * @Title: TeplOverwriteIndicator * * #TeplOverwriteIndicator indicates the mode in which text edition occurs: * insert or overwrite. * * See for example the #GtkTextView:overwrite property. * * The usual case is to pack this widget in a #GtkStatusbar. * * # TODO * * It is planned to extend this widget to be able to click on / activate it to * change the mode, with a #GtkPopover for example (but this would be optional, * with a "chooser" boolean construct-only property). * * With a different styling when in overwrite mode. * * Because not everybody is familiar with the key on the keyboard to switch * between the different modes. */ struct _TeplOverwriteIndicatorPrivate { GtkStack *stack; GtkLabel *label_insert; GtkLabel *label_overwrite; GtkTextView *view; /* owned */ TeplSignalGroup *view_signal_group; guint overwrite : 1; }; enum { PROP_0, PROP_OVERWRITE, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplOverwriteIndicator, tepl_overwrite_indicator, GTK_TYPE_BIN) static const gchar * get_insert_string (void) { /* Translators: "INS" is the abbreviation for "Insert", for the text * cursor mode. The translation should be short too. */ return _("INS"); } static const gchar * get_overwrite_string (void) { /* Translators: "OVR" is the abbreviation for "Overwrite", for the text * cursor mode. The translation should be short too. */ return _("OVR"); } static gchar * get_string_with_padding (gboolean overwrite) { const gchar *str; str = overwrite ? get_overwrite_string () : get_insert_string (); return _tepl_utils_statusbar_add_padding_to_text (str); } static void tepl_overwrite_indicator_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplOverwriteIndicator *indicator = TEPL_OVERWRITE_INDICATOR (object); switch (prop_id) { case PROP_OVERWRITE: g_value_set_boolean (value, tepl_overwrite_indicator_get_overwrite (indicator)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_overwrite_indicator_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplOverwriteIndicator *indicator = TEPL_OVERWRITE_INDICATOR (object); switch (prop_id) { case PROP_OVERWRITE: tepl_overwrite_indicator_set_overwrite (indicator, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_overwrite_indicator_dispose (GObject *object) { TeplOverwriteIndicator *indicator = TEPL_OVERWRITE_INDICATOR (object); tepl_signal_group_clear (&indicator->priv->view_signal_group); tepl_utils_set_widget ((GtkWidget **) &indicator->priv->view, NULL); /* In case a public function is called after a first dispose. */ indicator->priv->stack = NULL; indicator->priv->label_insert = NULL; indicator->priv->label_overwrite = NULL; G_OBJECT_CLASS (tepl_overwrite_indicator_parent_class)->dispose (object); } static void tepl_overwrite_indicator_class_init (TeplOverwriteIndicatorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_overwrite_indicator_get_property; object_class->set_property = tepl_overwrite_indicator_set_property; object_class->dispose = tepl_overwrite_indicator_dispose; /** * TeplOverwriteIndicator:overwrite: * * - If %TRUE, indicates the overwrite mode. * - If %FALSE, indicates the insert mode. * * Since: 6.4 */ properties[PROP_OVERWRITE] = g_param_spec_boolean ("overwrite", "overwrite", "", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_overwrite_indicator_init (TeplOverwriteIndicator *indicator) { gchar *label_insert_str; gchar *label_overwrite_str; indicator->priv = tepl_overwrite_indicator_get_instance_private (indicator); label_insert_str = get_string_with_padding (FALSE); label_overwrite_str = get_string_with_padding (TRUE); indicator->priv->label_insert = GTK_LABEL (gtk_label_new (label_insert_str)); indicator->priv->label_overwrite = GTK_LABEL (gtk_label_new (label_overwrite_str)); g_free (label_insert_str); g_free (label_overwrite_str); gtk_widget_show (GTK_WIDGET (indicator->priv->label_insert)); gtk_widget_show (GTK_WIDGET (indicator->priv->label_overwrite)); indicator->priv->stack = GTK_STACK (gtk_stack_new ()); gtk_container_add (GTK_CONTAINER (indicator->priv->stack), GTK_WIDGET (indicator->priv->label_insert)); gtk_container_add (GTK_CONTAINER (indicator->priv->stack), GTK_WIDGET (indicator->priv->label_overwrite)); gtk_stack_set_visible_child (indicator->priv->stack, GTK_WIDGET (indicator->priv->label_insert)); gtk_widget_show (GTK_WIDGET (indicator->priv->stack)); gtk_container_add (GTK_CONTAINER (indicator), GTK_WIDGET (indicator->priv->stack)); } /** * tepl_overwrite_indicator_new: * * Returns: (transfer floating): a new #TeplOverwriteIndicator. * Since: 6.4 */ TeplOverwriteIndicator * tepl_overwrite_indicator_new (void) { return g_object_new (TEPL_TYPE_OVERWRITE_INDICATOR, NULL); } /** * tepl_overwrite_indicator_get_overwrite: * @indicator: a #TeplOverwriteIndicator. * * Returns: the value of the #TeplOverwriteIndicator:overwrite property. * Since: 6.4 */ gboolean tepl_overwrite_indicator_get_overwrite (TeplOverwriteIndicator *indicator) { g_return_val_if_fail (TEPL_IS_OVERWRITE_INDICATOR (indicator), FALSE); return indicator->priv->overwrite; } /** * tepl_overwrite_indicator_set_overwrite: * @indicator: a #TeplOverwriteIndicator. * @overwrite: the new value. * * Sets a new value to the #TeplOverwriteIndicator:overwrite property. * * Since: 6.4 */ void tepl_overwrite_indicator_set_overwrite (TeplOverwriteIndicator *indicator, gboolean overwrite) { g_return_if_fail (TEPL_IS_OVERWRITE_INDICATOR (indicator)); overwrite = overwrite != FALSE; if (indicator->priv->overwrite != overwrite) { indicator->priv->overwrite = overwrite; if (overwrite) { gtk_stack_set_visible_child (indicator->priv->stack, GTK_WIDGET (indicator->priv->label_overwrite)); } else { gtk_stack_set_visible_child (indicator->priv->stack, GTK_WIDGET (indicator->priv->label_insert)); } g_object_notify_by_pspec (G_OBJECT (indicator), properties[PROP_OVERWRITE]); } } static void update_overwrite (TeplOverwriteIndicator *indicator) { if (indicator->priv->view != NULL) { gboolean overwrite; overwrite = gtk_text_view_get_overwrite (indicator->priv->view); tepl_overwrite_indicator_set_overwrite (indicator, overwrite); gtk_widget_show (GTK_WIDGET (indicator->priv->stack)); } else { gtk_widget_hide (GTK_WIDGET (indicator->priv->stack)); } } static void overwrite_notify_cb (GtkTextView *view, GParamSpec *pspec, TeplOverwriteIndicator *indicator) { update_overwrite (indicator); } static void connect_to_view (TeplOverwriteIndicator *indicator) { tepl_signal_group_clear (&indicator->priv->view_signal_group); if (indicator->priv->view == NULL) { return; } indicator->priv->view_signal_group = tepl_signal_group_new (G_OBJECT (indicator->priv->view)); tepl_signal_group_add (indicator->priv->view_signal_group, g_signal_connect (indicator->priv->view, "notify::overwrite", G_CALLBACK (overwrite_notify_cb), indicator)); } /** * tepl_overwrite_indicator_set_view: * @indicator: a #TeplOverwriteIndicator. * @view: (nullable): a #GtkTextView, or %NULL. * * Sets a #GtkTextView to update automatically the state of @indicator according * to @view. If @view is %NULL, then @indicator will be empty. * * Since: 6.4 */ void tepl_overwrite_indicator_set_view (TeplOverwriteIndicator *indicator, GtkTextView *view) { g_return_if_fail (TEPL_IS_OVERWRITE_INDICATOR (indicator)); g_return_if_fail (view == NULL || GTK_IS_TEXT_VIEW (view)); tepl_utils_set_widget ((GtkWidget **) &indicator->priv->view, (GtkWidget *) view); connect_to_view (indicator); update_overwrite (indicator); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-overwrite-indicator.h000066400000000000000000000040761526404732400303020ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_OVERWRITE_INDICATOR_H #define TEPL_OVERWRITE_INDICATOR_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_OVERWRITE_INDICATOR (tepl_overwrite_indicator_get_type ()) #define TEPL_OVERWRITE_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_OVERWRITE_INDICATOR, TeplOverwriteIndicator)) #define TEPL_OVERWRITE_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_OVERWRITE_INDICATOR, TeplOverwriteIndicatorClass)) #define TEPL_IS_OVERWRITE_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_OVERWRITE_INDICATOR)) #define TEPL_IS_OVERWRITE_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_OVERWRITE_INDICATOR)) #define TEPL_OVERWRITE_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_OVERWRITE_INDICATOR, TeplOverwriteIndicatorClass)) typedef struct _TeplOverwriteIndicator TeplOverwriteIndicator; typedef struct _TeplOverwriteIndicatorClass TeplOverwriteIndicatorClass; typedef struct _TeplOverwriteIndicatorPrivate TeplOverwriteIndicatorPrivate; struct _TeplOverwriteIndicator { GtkBin parent; TeplOverwriteIndicatorPrivate *priv; }; struct _TeplOverwriteIndicatorClass { GtkBinClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_overwrite_indicator_get_type (void); G_MODULE_EXPORT TeplOverwriteIndicator * tepl_overwrite_indicator_new (void); G_MODULE_EXPORT gboolean tepl_overwrite_indicator_get_overwrite (TeplOverwriteIndicator *indicator); G_MODULE_EXPORT void tepl_overwrite_indicator_set_overwrite (TeplOverwriteIndicator *indicator, gboolean overwrite); G_MODULE_EXPORT void tepl_overwrite_indicator_set_view (TeplOverwriteIndicator *indicator, GtkTextView *view); G_END_DECLS #endif /* TEPL_OVERWRITE_INDICATOR_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-item.c000066400000000000000000000236641526404732400263340ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-panel-item.h" #include "tepl-utils.h" /** * SECTION:panel-item * @Title: TeplPanelItem * @Short_description: Panel item data * * A #TeplPanelItem object contains a #GtkWidget plus associated information. */ /* API design * ========== * * Have properties so that the class is extensible without breaking the API. In * that case, applications can use g_object_new() directly, or a * tepl_panel_item_new_full() could be added, or with a Builder class. */ struct _TeplPanelItemPrivate { /* Owned. The ref is released on ::destroy. */ GtkWidget *widget; gchar *name; gchar *title; gchar *icon_name; gint position; }; enum { PROP_0, PROP_WIDGET, PROP_NAME, PROP_TITLE, PROP_ICON_NAME, PROP_POSITION, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplPanelItem, tepl_panel_item, G_TYPE_OBJECT) static gboolean is_null_or_valid_utf8 (const gchar *str) { return (str == NULL || g_utf8_validate (str, -1, NULL)); } static void set_name (TeplPanelItem *item, const gchar *name) { g_return_if_fail (name != NULL); g_return_if_fail (g_utf8_validate (name, -1, NULL)); g_set_str (&item->priv->name, name); } static void set_title (TeplPanelItem *item, const gchar *title) { g_return_if_fail (is_null_or_valid_utf8 (title)); g_set_str (&item->priv->title, title); } static void tepl_panel_item_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplPanelItem *item = TEPL_PANEL_ITEM (object); switch (prop_id) { case PROP_WIDGET: g_value_set_object (value, tepl_panel_item_get_widget (item)); break; case PROP_NAME: g_value_set_string (value, tepl_panel_item_get_name (item)); break; case PROP_TITLE: g_value_set_string (value, tepl_panel_item_get_title (item)); break; case PROP_ICON_NAME: g_value_set_string (value, tepl_panel_item_get_icon_name (item)); break; case PROP_POSITION: g_value_set_int (value, tepl_panel_item_get_position (item)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_panel_item_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplPanelItem *item = TEPL_PANEL_ITEM (object); switch (prop_id) { case PROP_WIDGET: tepl_utils_set_widget (&item->priv->widget, g_value_get_object (value)); break; case PROP_NAME: set_name (item, g_value_get_string (value)); break; case PROP_TITLE: set_title (item, g_value_get_string (value)); break; case PROP_ICON_NAME: g_set_str (&item->priv->icon_name, g_value_get_string (value)); break; case PROP_POSITION: item->priv->position = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_panel_item_dispose (GObject *object) { TeplPanelItem *item = TEPL_PANEL_ITEM (object); tepl_utils_set_widget (&item->priv->widget, NULL); G_OBJECT_CLASS (tepl_panel_item_parent_class)->dispose (object); } static void tepl_panel_item_finalize (GObject *object) { TeplPanelItem *item = TEPL_PANEL_ITEM (object); g_free (item->priv->name); g_free (item->priv->title); g_free (item->priv->icon_name); G_OBJECT_CLASS (tepl_panel_item_parent_class)->finalize (object); } static void tepl_panel_item_class_init (TeplPanelItemClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_panel_item_get_property; object_class->set_property = tepl_panel_item_set_property; object_class->dispose = tepl_panel_item_dispose; object_class->finalize = tepl_panel_item_finalize; /** * TeplPanelItem:widget: * * The #GtkWidget (the main content). * * Since: 6.11 */ properties[PROP_WIDGET] = g_param_spec_object ("widget", "widget", "", GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplPanelItem:name: * * The name. * * It is an ID as a UTF-8 string. It is not displayed in the UI. It * uniquely identifies an item within a list. * * Since: 6.11 */ properties[PROP_NAME] = g_param_spec_string ("name", "name", "", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplPanelItem:title: * * The title. * * It is a human-readable UTF-8 string that can be shown in the UI to * choose this item. * * Since: 6.11 */ properties[PROP_TITLE] = g_param_spec_string ("title", "title", "", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplPanelItem:icon-name: * * The icon name. * * It can be shown in the UI to choose this item, for example with the * #GtkImage's #GtkImage:icon-name property. * * Since: 6.11 */ properties[PROP_ICON_NAME] = g_param_spec_string ("icon-name", "icon-name", "", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); /** * TeplPanelItem:position: * * The position. * * Used to sort items in the desired order. * * Since: 6.11 */ properties[PROP_POSITION] = g_param_spec_int ("position", "position", "", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_panel_item_init (TeplPanelItem *item) { item->priv = tepl_panel_item_get_instance_private (item); } /** * tepl_panel_item_new: * @widget: a #GtkWidget. * @name: the name. * @title: (nullable): the title. * @icon_name: (nullable): the icon-name. * @position: the position. * * Creates a new #TeplPanelItem object. * * See the properties for the meaning of the parameters. * * Returns: (transfer full): a new #TeplPanelItem object. * Since: 6.11 */ TeplPanelItem * tepl_panel_item_new (GtkWidget *widget, const gchar *name, const gchar *title, const gchar *icon_name, gint position) { g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); g_return_val_if_fail (name != NULL, NULL); return g_object_new (TEPL_TYPE_PANEL_ITEM, "widget", widget, "name", name, "title", title, "icon-name", icon_name, "position", position, NULL); } /** * tepl_panel_item_get_widget: * @item: a #TeplPanelItem. * * Returns: (transfer none) (nullable): the value of the #TeplPanelItem:widget * property. * Since: 6.8 */ GtkWidget * tepl_panel_item_get_widget (TeplPanelItem *item) { g_return_val_if_fail (TEPL_IS_PANEL_ITEM (item), NULL); return item->priv->widget; } /** * tepl_panel_item_get_name: * @item: a #TeplPanelItem. * * Returns: the value of the #TeplPanelItem:name property. * Since: 6.8 */ const gchar * tepl_panel_item_get_name (TeplPanelItem *item) { g_return_val_if_fail (TEPL_IS_PANEL_ITEM (item), NULL); return item->priv->name; } /** * tepl_panel_item_get_title: * @item: a #TeplPanelItem. * * Returns: (nullable): the value of the #TeplPanelItem:title property. * Since: 6.8 */ const gchar * tepl_panel_item_get_title (TeplPanelItem *item) { g_return_val_if_fail (TEPL_IS_PANEL_ITEM (item), NULL); return item->priv->title; } /** * tepl_panel_item_get_icon_name: * @item: a #TeplPanelItem. * * Returns: (nullable): the value of the #TeplPanelItem:icon-name property. * Since: 6.8 */ const gchar * tepl_panel_item_get_icon_name (TeplPanelItem *item) { g_return_val_if_fail (TEPL_IS_PANEL_ITEM (item), NULL); return item->priv->icon_name; } /** * tepl_panel_item_get_position: * @item: a #TeplPanelItem. * * Returns: the value of the #TeplPanelItem:position property. * Since: 6.11 */ gint tepl_panel_item_get_position (TeplPanelItem *item) { g_return_val_if_fail (TEPL_IS_PANEL_ITEM (item), 0); return item->priv->position; } /** * tepl_panel_item_compare_by_title: * @a: a #TeplPanelItem. * @b: a #TeplPanelItem. * * A #GCompareFunc that takes into account only the #TeplPanelItem:title * property. * * Returns: the usual return value for a #GCompareFunc. * Since: 6.8 */ gint tepl_panel_item_compare_by_title (TeplPanelItem *a, TeplPanelItem *b) { const gchar *title_a; const gchar *title_b; gchar *normalized_title_a = NULL; gchar *normalized_title_b = NULL; gint result = 0; g_return_val_if_fail (TEPL_IS_PANEL_ITEM (a), 0); g_return_val_if_fail (TEPL_IS_PANEL_ITEM (b), 0); title_a = tepl_panel_item_get_title (a); title_b = tepl_panel_item_get_title (b); /* Put untitled items at the end */ if (title_a == NULL && title_b == NULL) { result = 0; goto out; } if (title_a == NULL) { result = 1; goto out; } if (title_b == NULL) { result = -1; goto out; } /* UTF-8 comparison */ normalized_title_a = g_utf8_normalize (title_a, -1, G_NORMALIZE_ALL); normalized_title_b = g_utf8_normalize (title_b, -1, G_NORMALIZE_ALL); result = g_utf8_collate (normalized_title_a, normalized_title_b); out: g_free (normalized_title_a); g_free (normalized_title_b); return result; } /** * tepl_panel_item_compare: * @a: a #TeplPanelItem. * @b: a #TeplPanelItem. * * A #GCompareFunc that takes into account the #TeplPanelItem:position property * in priority, and falls back to the #TeplPanelItem:title property if two items * have the same position. * * Returns: the usual return value for a #GCompareFunc. * Since: 6.11 */ gint tepl_panel_item_compare (TeplPanelItem *a, TeplPanelItem *b) { g_return_val_if_fail (TEPL_IS_PANEL_ITEM (a), 0); g_return_val_if_fail (TEPL_IS_PANEL_ITEM (b), 0); if (a->priv->position == b->priv->position) { return tepl_panel_item_compare_by_title (a, b); } return a->priv->position - b->priv->position; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-item.h000066400000000000000000000041751526404732400263350ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANEL_ITEM_H #define TEPL_PANEL_ITEM_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PANEL_ITEM (tepl_panel_item_get_type ()) #define TEPL_PANEL_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL_ITEM, TeplPanelItem)) #define TEPL_PANEL_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PANEL_ITEM, TeplPanelItemClass)) #define TEPL_IS_PANEL_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL_ITEM)) #define TEPL_IS_PANEL_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PANEL_ITEM)) #define TEPL_PANEL_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PANEL_ITEM, TeplPanelItemClass)) typedef struct _TeplPanelItem TeplPanelItem; typedef struct _TeplPanelItemClass TeplPanelItemClass; typedef struct _TeplPanelItemPrivate TeplPanelItemPrivate; struct _TeplPanelItem { GObject parent; TeplPanelItemPrivate *priv; }; struct _TeplPanelItemClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_panel_item_get_type (void); G_MODULE_EXPORT TeplPanelItem * tepl_panel_item_new (GtkWidget *widget, const gchar *name, const gchar *title, const gchar *icon_name, gint position); G_MODULE_EXPORT GtkWidget * tepl_panel_item_get_widget (TeplPanelItem *item); G_MODULE_EXPORT const gchar * tepl_panel_item_get_name (TeplPanelItem *item); G_MODULE_EXPORT const gchar * tepl_panel_item_get_title (TeplPanelItem *item); G_MODULE_EXPORT const gchar * tepl_panel_item_get_icon_name (TeplPanelItem *item); G_MODULE_EXPORT gint tepl_panel_item_get_position (TeplPanelItem *item); G_MODULE_EXPORT gint tepl_panel_item_compare (TeplPanelItem *a, TeplPanelItem *b); G_MODULE_EXPORT gint tepl_panel_item_compare_by_title (TeplPanelItem *a, TeplPanelItem *b); G_END_DECLS #endif /* TEPL_PANEL_ITEM_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-notebook.c000066400000000000000000000133261526404732400272100ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2014 - Paolo Borelli * SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-panel-notebook.h" #include "tepl-panel.h" /** * SECTION:panel-notebook * @Title: TeplPanelNotebook * @Short_description: Side or bottom panel container based on #GtkNotebook * * Side or bottom panel container based on #GtkNotebook. * * This class is useful if you want to expose only #TeplPanel in an API. */ struct _TeplPanelNotebookPrivate { TeplPanelSimple *panel_simple; GtkNotebook *notebook; }; #define TEPL_PANEL_ITEM_KEY "tepl-panel-item-key" G_DEFINE_TYPE_WITH_PRIVATE (TeplPanelNotebook, tepl_panel_notebook, G_TYPE_OBJECT) /* Prototypes */ static void notebook_switch_page_cb (GtkNotebook *notebook, GtkWidget *page, guint page_num, TeplPanelNotebook *self); static void empty_notebook (GtkNotebook *notebook) { while (gtk_notebook_get_n_pages (notebook) > 0) { /* Remove the last page. Maybe more efficient than removing the * first page, in order to not affect the indexes of the pages. * But the GtkNotebook docs don't explain which is faster, so * it's just a guess, and it has not been measured. */ gtk_notebook_remove_page (notebook, -1); } } static void notebook_page_widget_set_panel_item (GtkWidget *notebook_page_widget, TeplPanelItem *panel_item) { g_object_set_data_full (G_OBJECT (notebook_page_widget), TEPL_PANEL_ITEM_KEY, g_object_ref (panel_item), g_object_unref); } static TeplPanelItem * notebook_page_widget_get_panel_item (GtkWidget *notebook_page_widget) { return TEPL_PANEL_ITEM (g_object_get_data (G_OBJECT (notebook_page_widget), TEPL_PANEL_ITEM_KEY)); } static void add_item_to_notebook (TeplPanelNotebook *self, TeplPanelItem *item, gboolean jump_to) { GtkWidget *widget; const gchar *title; widget = tepl_panel_item_get_widget (item); if (widget == NULL) { return; } notebook_page_widget_set_panel_item (widget, item); title = tepl_panel_item_get_title (item); gtk_notebook_append_page (self->priv->notebook, widget, NULL); gtk_notebook_set_tab_label_text (self->priv->notebook, widget, title); if (jump_to) { gint page_num; page_num = gtk_notebook_page_num (self->priv->notebook, widget); gtk_notebook_set_current_page (self->priv->notebook, page_num); } } static void fill_notebook (TeplPanelNotebook *self) { GList *items; GList *l; TeplPanelItem *active_item; items = tepl_panel_simple_get_items (self->priv->panel_simple); items = g_list_sort (items, (GCompareFunc) tepl_panel_item_compare); active_item = tepl_panel_simple_get_active_item (self->priv->panel_simple); for (l = items; l != NULL; l = l->next) { TeplPanelItem *cur_item = TEPL_PANEL_ITEM (l->data); add_item_to_notebook (self, cur_item, cur_item == active_item); } g_list_free_full (items, g_object_unref); } static void repopulate_notebook (TeplPanelNotebook *self) { g_signal_handlers_block_by_func (self->priv->notebook, notebook_switch_page_cb, self); empty_notebook (self->priv->notebook); fill_notebook (self); g_signal_handlers_unblock_by_func (self->priv->notebook, notebook_switch_page_cb, self); } static void panel_simple_changed_cb (TeplPanelSimple *panel_simple, TeplPanelNotebook *self) { repopulate_notebook (self); } static void notebook_switch_page_cb (GtkNotebook *notebook, GtkWidget *page, guint page_num, TeplPanelNotebook *self) { TeplPanelItem *panel_item; panel_item = notebook_page_widget_get_panel_item (page); g_signal_handlers_block_by_func (self->priv->panel_simple, panel_simple_changed_cb, self); tepl_panel_set_active (TEPL_PANEL (self->priv->panel_simple), panel_item); g_signal_handlers_unblock_by_func (self->priv->panel_simple, panel_simple_changed_cb, self); } static void tepl_panel_notebook_dispose (GObject *object) { TeplPanelNotebook *self = TEPL_PANEL_NOTEBOOK (object); g_clear_object (&self->priv->panel_simple); g_clear_object (&self->priv->notebook); G_OBJECT_CLASS (tepl_panel_notebook_parent_class)->dispose (object); } static void tepl_panel_notebook_class_init (TeplPanelNotebookClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_panel_notebook_dispose; } static void tepl_panel_notebook_init (TeplPanelNotebook *self) { self->priv = tepl_panel_notebook_get_instance_private (self); } /** * tepl_panel_notebook_new: * @panel_simple: a #TeplPanelSimple. * @notebook: a #GtkNotebook. * * Creates a new #TeplPanelNotebook. * * @notebook needs to be empty (no pages), and should be pre-configured. Then * the #TeplPanelNotebook will handle @notebook, so you should not modify it * afterwards. * * Returns: (transfer full): a new #TeplPanelNotebook object. * Since: 6.11 */ TeplPanelNotebook * tepl_panel_notebook_new (TeplPanelSimple *panel_simple, GtkNotebook *notebook) { TeplPanelNotebook *self; g_return_val_if_fail (TEPL_IS_PANEL_SIMPLE (panel_simple), NULL); g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL); g_return_val_if_fail (gtk_notebook_get_n_pages (notebook) == 0, NULL); self = g_object_new (TEPL_TYPE_PANEL_NOTEBOOK, NULL); self->priv->panel_simple = g_object_ref (panel_simple); self->priv->notebook = g_object_ref_sink (notebook); g_signal_connect_object (self->priv->panel_simple, "changed", G_CALLBACK (panel_simple_changed_cb), self, G_CONNECT_DEFAULT); g_signal_connect_object (self->priv->notebook, "switch-page", G_CALLBACK (notebook_switch_page_cb), self, G_CONNECT_AFTER); repopulate_notebook (self); return self; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-notebook.h000066400000000000000000000031361526404732400272130ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANEL_NOTEBOOK_H #define TEPL_PANEL_NOTEBOOK_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PANEL_NOTEBOOK (tepl_panel_notebook_get_type ()) #define TEPL_PANEL_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL_NOTEBOOK, TeplPanelNotebook)) #define TEPL_PANEL_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PANEL_NOTEBOOK, TeplPanelNotebookClass)) #define TEPL_IS_PANEL_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL_NOTEBOOK)) #define TEPL_IS_PANEL_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PANEL_NOTEBOOK)) #define TEPL_PANEL_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PANEL_NOTEBOOK, TeplPanelNotebookClass)) typedef struct _TeplPanelNotebook TeplPanelNotebook; typedef struct _TeplPanelNotebookClass TeplPanelNotebookClass; typedef struct _TeplPanelNotebookPrivate TeplPanelNotebookPrivate; struct _TeplPanelNotebook { GObject parent; TeplPanelNotebookPrivate *priv; }; struct _TeplPanelNotebookClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_panel_notebook_get_type (void); G_MODULE_EXPORT TeplPanelNotebook * tepl_panel_notebook_new (TeplPanelSimple *panel_simple, GtkNotebook *notebook); G_END_DECLS #endif /* TEPL_PANEL_NOTEBOOK_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-simple.c000066400000000000000000000252161526404732400266620ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-panel-simple.h" #include "tepl-panel.h" /** * SECTION:panel-simple * @Title: TeplPanelSimple * @Short_description: A set of #TeplPanelItem's * * #TeplPanelSimple is a simple implementation of the #TeplPanel interface, * containing a set of #TeplPanelItem's. * * By using this class, the #TeplPanelItem widgets are not yet packed into a * #GtkContainer. That is a job for other classes. */ struct _TeplPanelSimplePrivate { /* Element type: owned "TeplPanelItem *" */ GList *items; TeplPanelItem *active_item; }; enum { SIGNAL_ADD_ITEM, SIGNAL_REMOVE_ITEM, SIGNAL_CHANGED, N_SIGNALS }; enum { PROP_0, PROP_ACTIVE_ITEM, PROP_ACTIVE_ITEM_NAME, N_PROPERTIES }; static guint signals[N_SIGNALS]; static GParamSpec *properties[N_PROPERTIES]; static void tepl_panel_interface_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (TeplPanelSimple, tepl_panel_simple, G_TYPE_OBJECT, G_ADD_PRIVATE (TeplPanelSimple) G_IMPLEMENT_INTERFACE (TEPL_TYPE_PANEL, tepl_panel_interface_init)) static void tepl_panel_simple_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplPanelSimple *panel = TEPL_PANEL_SIMPLE (object); switch (prop_id) { case PROP_ACTIVE_ITEM: g_value_set_object (value, tepl_panel_simple_get_active_item (panel)); break; case PROP_ACTIVE_ITEM_NAME: g_value_set_string (value, tepl_panel_simple_get_active_item_name (panel)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_panel_simple_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplPanelSimple *panel = TEPL_PANEL_SIMPLE (object); switch (prop_id) { case PROP_ACTIVE_ITEM: tepl_panel_set_active (TEPL_PANEL (panel), g_value_get_object (value)); break; case PROP_ACTIVE_ITEM_NAME: tepl_panel_simple_set_active_item_name (panel, g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_panel_simple_dispose (GObject *object) { TeplPanelSimple *panel = TEPL_PANEL_SIMPLE (object); g_list_free_full (panel->priv->items, g_object_unref); panel->priv->items = NULL; g_clear_object (&panel->priv->active_item); G_OBJECT_CLASS (tepl_panel_simple_parent_class)->dispose (object); } static void tepl_panel_simple_add_item (TeplPanelSimple *panel, TeplPanelItem *item) { g_return_if_fail (g_list_find (panel->priv->items, item) == NULL); panel->priv->items = g_list_prepend (panel->priv->items, g_object_ref (item)); } static void tepl_panel_simple_remove_item (TeplPanelSimple *panel, TeplPanelItem *item) { GList *node; if (panel->priv->active_item == item) { tepl_panel_set_active (TEPL_PANEL (panel), NULL); } node = g_list_find (panel->priv->items, item); if (node == NULL) { return; } g_object_unref (item); panel->priv->items = g_list_delete_link (panel->priv->items, node); } static void tepl_panel_simple_changed (TeplPanelSimple *panel) { /* Do nothing. */ } static void tepl_panel_simple_class_init (TeplPanelSimpleClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); klass->add_item = tepl_panel_simple_add_item; klass->remove_item = tepl_panel_simple_remove_item; klass->changed = tepl_panel_simple_changed; object_class->get_property = tepl_panel_simple_get_property; object_class->set_property = tepl_panel_simple_set_property; object_class->dispose = tepl_panel_simple_dispose; /** * TeplPanelSimple::add-item: * @panel: the #TeplPanelSimple emitting the signal. * @item: the #TeplPanelItem being added. * * The ::add-item signal is emitted when a #TeplPanelItem needs to be * added. * * It is a %G_SIGNAL_RUN_LAST signal: the item is added by the * #TeplPanelSimple's method handler for this signal. * * Since: 6.11 */ signals[SIGNAL_ADD_ITEM] = g_signal_new ("add-item", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (TeplPanelSimpleClass, add_item), NULL, NULL, NULL, G_TYPE_NONE, 1, TEPL_TYPE_PANEL_ITEM); /** * TeplPanelSimple::remove-item: * @panel: the #TeplPanelSimple emitting the signal. * @item: the #TeplPanelItem being removed. * * The ::remove-item signal is emitted when a #TeplPanelItem needs to be * removed. * * It is a %G_SIGNAL_RUN_LAST signal: the item is removed by the * #TeplPanelSimple's method handler for this signal. * * Since: 6.11 */ signals[SIGNAL_REMOVE_ITEM] = g_signal_new ("remove-item", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (TeplPanelSimpleClass, remove_item), NULL, NULL, NULL, G_TYPE_NONE, 1, TEPL_TYPE_PANEL_ITEM); /** * TeplPanelSimple::changed: * @panel: the #TeplPanelSimple emitting the signal. * * The ::changed signal is for convenience: it is emitted when the * #TeplPanelSimple::add-item and #TeplPanelSimple::remove-item signals * are emitted, and also when the #TeplPanelSimple:active-item property * changes. * * It is a %G_SIGNAL_RUN_FIRST signal: the action is already done. * * This signal is useful if you don't need the more detailed information * on what has changed. * * Since: 6.11 */ signals[SIGNAL_CHANGED] = g_signal_new ("changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (TeplPanelSimpleClass, changed), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * TeplPanelSimple:active-item: * * The #TeplPanelItem currently shown. * * Since: 6.11 */ properties[PROP_ACTIVE_ITEM] = g_param_spec_object ("active-item", "active-item", "", TEPL_TYPE_PANEL_ITEM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** * TeplPanelSimple:active-item-name: * * The name of the #TeplPanelSimple:active-item. * * Since: 6.11 */ properties[PROP_ACTIVE_ITEM_NAME] = g_param_spec_string ("active-item-name", "active-item-name", "", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_panel_simple_init (TeplPanelSimple *panel) { panel->priv = tepl_panel_simple_get_instance_private (panel); } static void tepl_panel_simple_add (TeplPanel *panel, TeplPanelItem *item) { g_object_ref (item); g_signal_emit (panel, signals[SIGNAL_ADD_ITEM], 0, item); g_signal_emit (panel, signals[SIGNAL_CHANGED], 0); g_object_unref (item); } static void tepl_panel_simple_remove (TeplPanel *panel, TeplPanelItem *item) { g_object_ref (item); g_signal_emit (panel, signals[SIGNAL_REMOVE_ITEM], 0, item); g_signal_emit (panel, signals[SIGNAL_CHANGED], 0); g_object_unref (item); } static void tepl_panel_simple_set_active (TeplPanel *panel, TeplPanelItem *item) { TeplPanelSimple *panel_simple = TEPL_PANEL_SIMPLE (panel); if (g_set_object (&panel_simple->priv->active_item, item)) { g_object_notify_by_pspec (G_OBJECT (panel_simple), properties[PROP_ACTIVE_ITEM]); g_object_notify_by_pspec (G_OBJECT (panel_simple), properties[PROP_ACTIVE_ITEM_NAME]); g_signal_emit (panel, signals[SIGNAL_CHANGED], 0); } } static void tepl_panel_interface_init (gpointer g_iface, gpointer iface_data) { TeplPanelInterface *interface = g_iface; interface->add = tepl_panel_simple_add; interface->remove = tepl_panel_simple_remove; interface->set_active = tepl_panel_simple_set_active; } /** * tepl_panel_simple_new: * * Returns: (transfer full): a new #TeplPanelSimple object. * Since: 6.11 */ TeplPanelSimple * tepl_panel_simple_new (void) { return g_object_new (TEPL_TYPE_PANEL_SIMPLE, NULL); } /** * tepl_panel_simple_get_items: * @panel: a #TeplPanelSimple. * * Returns: (transfer full) (element-type TeplPanelItem): all the items of * @panel. * Since: 6.11 */ GList * tepl_panel_simple_get_items (TeplPanelSimple *panel) { GList *ret; GList *l; g_return_val_if_fail (TEPL_IS_PANEL_SIMPLE (panel), NULL); ret = g_list_copy (panel->priv->items); for (l = ret; l != NULL; l = l->next) { g_object_ref (l->data); } return ret; } /** * tepl_panel_simple_get_active_item: * @panel: a #TeplPanelSimple. * * Returns: (transfer none) (nullable): the value of the * #TeplPanelSimple:active-item property. * Since: 6.11 */ TeplPanelItem * tepl_panel_simple_get_active_item (TeplPanelSimple *panel) { g_return_val_if_fail (TEPL_IS_PANEL_SIMPLE (panel), NULL); return panel->priv->active_item; } /** * tepl_panel_simple_get_active_item_name: * @panel: a #TeplPanelSimple. * * A convenience function. * * Returns: (nullable): the name of the #TeplPanelSimple:active-item. * Since: 6.11 */ const gchar * tepl_panel_simple_get_active_item_name (TeplPanelSimple *panel) { TeplPanelItem *item; g_return_val_if_fail (TEPL_IS_PANEL_SIMPLE (panel), NULL); item = tepl_panel_simple_get_active_item (panel); return item != NULL ? tepl_panel_item_get_name (item) : NULL; } /** * tepl_panel_simple_set_active_item_name: * @panel: a #TeplPanelSimple. * @name: (nullable): a name. * * A convenience function that calls tepl_panel_set_active() with the * #TeplPanelItem named @name (if found). * * Since: 6.11 */ void tepl_panel_simple_set_active_item_name (TeplPanelSimple *panel, const gchar *name) { GList *items; GList *l; g_return_if_fail (TEPL_IS_PANEL_SIMPLE (panel)); if (name == NULL) { tepl_panel_set_active (TEPL_PANEL (panel), NULL); return; } items = tepl_panel_simple_get_items (panel); for (l = items; l != NULL; l = l->next) { TeplPanelItem *cur_item = TEPL_PANEL_ITEM (l->data); const gchar *cur_item_name; cur_item_name = tepl_panel_item_get_name (cur_item); if (g_strcmp0 (cur_item_name, name) == 0) { tepl_panel_set_active (TEPL_PANEL (panel), cur_item); break; } } g_list_free_full (items, g_object_unref); } /** * tepl_panel_simple_has_several_items: * @panel: a #TeplPanelSimple. * * A convenience function. Useful to implement a switcher widget. * * Returns: whether @panel has more than one #TeplPanelItem. * Since: 6.11 */ gboolean tepl_panel_simple_has_several_items (TeplPanelSimple *panel) { g_return_val_if_fail (TEPL_IS_PANEL_SIMPLE (panel), FALSE); return (panel->priv->items != NULL && panel->priv->items->next != NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-simple.h000066400000000000000000000042371526404732400266670ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANEL_SIMPLE_H #define TEPL_PANEL_SIMPLE_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PANEL_SIMPLE (tepl_panel_simple_get_type ()) #define TEPL_PANEL_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL_SIMPLE, TeplPanelSimple)) #define TEPL_PANEL_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PANEL_SIMPLE, TeplPanelSimpleClass)) #define TEPL_IS_PANEL_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL_SIMPLE)) #define TEPL_IS_PANEL_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PANEL_SIMPLE)) #define TEPL_PANEL_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PANEL_SIMPLE, TeplPanelSimpleClass)) typedef struct _TeplPanelSimple TeplPanelSimple; typedef struct _TeplPanelSimpleClass TeplPanelSimpleClass; typedef struct _TeplPanelSimplePrivate TeplPanelSimplePrivate; struct _TeplPanelSimple { GObject parent; TeplPanelSimplePrivate *priv; }; struct _TeplPanelSimpleClass { GObjectClass parent_class; /* Signals */ void (*add_item) (TeplPanelSimple *panel, TeplPanelItem *item); void (*remove_item) (TeplPanelSimple *panel, TeplPanelItem *item); void (*changed) (TeplPanelSimple *panel); gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_panel_simple_get_type (void); G_MODULE_EXPORT TeplPanelSimple * tepl_panel_simple_new (void); G_MODULE_EXPORT GList * tepl_panel_simple_get_items (TeplPanelSimple *panel); G_MODULE_EXPORT TeplPanelItem * tepl_panel_simple_get_active_item (TeplPanelSimple *panel); G_MODULE_EXPORT const gchar * tepl_panel_simple_get_active_item_name (TeplPanelSimple *panel); G_MODULE_EXPORT void tepl_panel_simple_set_active_item_name (TeplPanelSimple *panel, const gchar *name); G_MODULE_EXPORT gboolean tepl_panel_simple_has_several_items (TeplPanelSimple *panel); G_END_DECLS #endif /* TEPL_PANEL_SIMPLE_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-stack.c000066400000000000000000000110011526404732400264610ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-panel-stack.h" /** * SECTION:panel-stack * @Title: TeplPanelStack * @Short_description: Side or bottom panel container based on #GtkStack * * #TeplPanelStack is a side or bottom panel container. It combines * #TeplPanelSimple and #GtkStack. */ struct _TeplPanelStackPrivate { TeplPanelSimple *panel_simple; GtkStack *stack; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplPanelStack, tepl_panel_stack, G_TYPE_OBJECT) static void panel_simple_add_item_cb (TeplPanelSimple *panel_simple, TeplPanelItem *item, TeplPanelStack *panel_stack) { GtkWidget *widget; widget = tepl_panel_item_get_widget (item); gtk_widget_show (widget); gtk_container_add_with_properties (GTK_CONTAINER (panel_stack->priv->stack), widget, "name", tepl_panel_item_get_name (item), "title", tepl_panel_item_get_title (item), "icon-name", tepl_panel_item_get_icon_name (item), "position", tepl_panel_item_get_position (item), NULL); } static void panel_simple_remove_item_cb (TeplPanelSimple *panel_simple, TeplPanelItem *item, TeplPanelStack *panel_stack) { GtkWidget *widget = tepl_panel_item_get_widget (item); if (widget != NULL) { gtk_container_remove (GTK_CONTAINER (panel_stack->priv->stack), widget); } } static void tepl_panel_stack_dispose (GObject *object) { TeplPanelStack *panel_stack = TEPL_PANEL_STACK (object); g_clear_object (&panel_stack->priv->panel_simple); g_clear_object (&panel_stack->priv->stack); G_OBJECT_CLASS (tepl_panel_stack_parent_class)->dispose (object); } static void tepl_panel_stack_class_init (TeplPanelStackClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_panel_stack_dispose; } static void tepl_panel_stack_init (TeplPanelStack *panel_stack) { panel_stack->priv = tepl_panel_stack_get_instance_private (panel_stack); } /** * tepl_panel_stack_new: * @panel_simple: (nullable): a #TeplPanelSimple, or %NULL to create one. * @stack: (nullable): a #GtkStack, or %NULL to create one. * * Returns: (transfer full): a new #TeplPanelStack object. * Since: 6.11 */ TeplPanelStack * tepl_panel_stack_new (TeplPanelSimple *panel_simple, GtkStack *stack) { TeplPanelStack *panel_stack; g_return_val_if_fail (panel_simple == NULL || TEPL_IS_PANEL_SIMPLE (panel_simple), NULL); g_return_val_if_fail (stack == NULL || GTK_IS_STACK (stack), NULL); panel_stack = g_object_new (TEPL_TYPE_PANEL_STACK, NULL); if (panel_simple == NULL) { panel_stack->priv->panel_simple = tepl_panel_simple_new (); } else { panel_stack->priv->panel_simple = g_object_ref (panel_simple); } if (stack == NULL) { panel_stack->priv->stack = GTK_STACK (gtk_stack_new ()); g_object_ref_sink (panel_stack->priv->stack); } else { panel_stack->priv->stack = g_object_ref_sink (stack); } g_signal_connect_object (panel_stack->priv->panel_simple, "add-item", G_CALLBACK (panel_simple_add_item_cb), panel_stack, G_CONNECT_AFTER); g_signal_connect_object (panel_stack->priv->panel_simple, "remove-item", G_CALLBACK (panel_simple_remove_item_cb), panel_stack, G_CONNECT_DEFAULT); g_object_bind_property (panel_stack->priv->panel_simple, "active-item-name", panel_stack->priv->stack, "visible-child-name", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); return panel_stack; } /** * tepl_panel_stack_get_panel_simple: * @panel_stack: a #TeplPanelStack. * * Gets the #TeplPanelSimple of @panel_stack. * * It permits to alter the #TeplPanelStack content through the #TeplPanel * functions. * * Returns: (transfer none): the #TeplPanelSimple of @panel_stack. * Since: 6.11 */ TeplPanelSimple * tepl_panel_stack_get_panel_simple (TeplPanelStack *panel_stack) { g_return_val_if_fail (TEPL_IS_PANEL_STACK (panel_stack), NULL); return panel_stack->priv->panel_simple; } /** * tepl_panel_stack_get_stack: * @panel_stack: a #TeplPanelStack. * * Gets the #GtkStack of @panel_stack. * * The #GtkStack is exposed in the public API because it is useful for creating * a #GtkStackSwitcher. * * If you need to alter the #TeplPanelStack content, you must use * tepl_panel_stack_get_panel_simple() instead. * * Returns: (transfer none): the #GtkStack of @panel_stack. * Since: 6.11 */ GtkStack * tepl_panel_stack_get_stack (TeplPanelStack *panel_stack) { g_return_val_if_fail (TEPL_IS_PANEL_STACK (panel_stack), NULL); return panel_stack->priv->stack; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-stack.h000066400000000000000000000033001526404732400264710ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANEL_STACK_H #define TEPL_PANEL_STACK_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PANEL_STACK (tepl_panel_stack_get_type ()) #define TEPL_PANEL_STACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL_STACK, TeplPanelStack)) #define TEPL_PANEL_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PANEL_STACK, TeplPanelStackClass)) #define TEPL_IS_PANEL_STACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL_STACK)) #define TEPL_IS_PANEL_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PANEL_STACK)) #define TEPL_PANEL_STACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PANEL_STACK, TeplPanelStackClass)) typedef struct _TeplPanelStack TeplPanelStack; typedef struct _TeplPanelStackClass TeplPanelStackClass; typedef struct _TeplPanelStackPrivate TeplPanelStackPrivate; struct _TeplPanelStack { GObject parent; TeplPanelStackPrivate *priv; }; struct _TeplPanelStackClass { GObjectClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_panel_stack_get_type (void); G_MODULE_EXPORT TeplPanelStack * tepl_panel_stack_new (TeplPanelSimple *panel_simple, GtkStack *stack); G_MODULE_EXPORT TeplPanelSimple * tepl_panel_stack_get_panel_simple (TeplPanelStack *panel_stack); G_MODULE_EXPORT GtkStack * tepl_panel_stack_get_stack (TeplPanelStack *panel_stack); G_END_DECLS #endif /* TEPL_PANEL_STACK_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-switcher-menu.c000066400000000000000000000175351526404732400301700ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-panel-switcher-menu.h" #include "tepl-panel.h" /** * SECTION:panel-switcher-menu * @Short_description: A controller for #TeplPanelSimple * @Title: TeplPanelSwitcherMenu * * Similar to #GtkStackSwitcher, but for a #TeplPanelSimple. * * This switcher widget is suitable to be put in a #GtkHeaderBar, to choose the * component of a side panel (for example). */ struct _TeplPanelSwitcherMenuPrivate { TeplPanelSimple *panel; GtkPopover *popover; }; #define TEPL_PANEL_ITEM_KEY "tepl-panel-item-key" G_DEFINE_TYPE_WITH_PRIVATE (TeplPanelSwitcherMenu, tepl_panel_switcher_menu, GTK_TYPE_BIN) static const gchar * get_title (TeplPanelSimple *panel) { TeplPanelItem *active_item = tepl_panel_simple_get_active_item (panel); return active_item != NULL ? tepl_panel_item_get_title (active_item) : NULL; } static GtkLabel * create_title_label (TeplPanelSwitcherMenu *switcher) { const gchar *title_of_displayed_component; GtkLabel *title; GtkStyleContext *style_context; title_of_displayed_component = get_title (switcher->priv->panel); title = GTK_LABEL (gtk_label_new (title_of_displayed_component)); /* To use a TeplPanelSwitcherMenu in a GtkHeaderBar. * This could be made configurable with an additional API. */ style_context = gtk_widget_get_style_context (GTK_WIDGET (title)); gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_TITLE); return title; } static GtkGrid * create_menu_button_title (TeplPanelSwitcherMenu *switcher) { GtkGrid *hgrid; GtkLabel *title_label; GtkWidget *down_arrow; hgrid = GTK_GRID (gtk_grid_new ()); gtk_grid_set_column_spacing (hgrid, 6); gtk_widget_set_valign (GTK_WIDGET (hgrid), GTK_ALIGN_CENTER); title_label = create_title_label (switcher); gtk_widget_set_valign (GTK_WIDGET (title_label), GTK_ALIGN_BASELINE); gtk_container_add (GTK_CONTAINER (hgrid), GTK_WIDGET (title_label)); down_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); gtk_widget_set_valign (down_arrow, GTK_ALIGN_BASELINE); gtk_container_add (GTK_CONTAINER (hgrid), down_arrow); return hgrid; } static void item_button_clicked_cb (GtkToggleButton *button, TeplPanelSwitcherMenu *switcher) { TeplPanelItem *item; if (!gtk_toggle_button_get_active (button)) { g_signal_handlers_block_by_func (button, item_button_clicked_cb, switcher); /* The user has clicked on the button that was already pressed * in. Keep it pressed in. * In this case the call to tepl_panel_set_active() doesn't * trigger the notify signal, so repopulate() won't be called. * But we still want to hide the popover. */ gtk_toggle_button_set_active (button, TRUE); g_signal_handlers_unblock_by_func (button, item_button_clicked_cb, switcher); } item = g_object_get_data (G_OBJECT (button), TEPL_PANEL_ITEM_KEY); g_return_if_fail (TEPL_IS_PANEL_ITEM (item)); /* Directly hide the GtkPopover, i.e. not with a transition. Because * repopulate() will be called, which will destroy everything first. * Closing the popover with a transition and destroying it at the same * time doesn't work well. It would be possible to wait before calling * repopulate(), but we prefer the simpler implementation. */ gtk_widget_hide (GTK_WIDGET (switcher->priv->popover)); tepl_panel_set_active (TEPL_PANEL (switcher->priv->panel), item); } static GtkToggleButton * create_item_button (TeplPanelSwitcherMenu *switcher, TeplPanelItem *item, gboolean is_active_item) { const gchar *title; GtkToggleButton *button; title = tepl_panel_item_get_title (item); button = GTK_TOGGLE_BUTTON (gtk_toggle_button_new_with_label (title)); gtk_toggle_button_set_active (button, is_active_item); gtk_widget_set_size_request (GTK_WIDGET (button), 100, -1); g_object_set_data_full (G_OBJECT (button), TEPL_PANEL_ITEM_KEY, g_object_ref (item), g_object_unref); g_signal_connect_object (button, "clicked", G_CALLBACK (item_button_clicked_cb), switcher, G_CONNECT_DEFAULT); return button; } static GtkPopover * create_popover (TeplPanelSwitcherMenu *switcher) { GtkPopover *popover; GtkGrid *vgrid; TeplPanelItem *active_item; GList *items; GList *l; popover = GTK_POPOVER (gtk_popover_new (NULL)); gtk_popover_set_position (popover, GTK_POS_BOTTOM); vgrid = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (vgrid, 6); g_object_set (vgrid, "margin", 10, NULL); active_item = tepl_panel_simple_get_active_item (switcher->priv->panel); items = tepl_panel_simple_get_items (switcher->priv->panel); items = g_list_sort (items, (GCompareFunc) tepl_panel_item_compare); for (l = items; l != NULL; l = l->next) { TeplPanelItem *cur_item = TEPL_PANEL_ITEM (l->data); GtkToggleButton *button; button = create_item_button (switcher, cur_item, cur_item == active_item); gtk_container_add (GTK_CONTAINER (vgrid), GTK_WIDGET (button)); } g_list_free_full (items, g_object_unref); gtk_widget_show_all (GTK_WIDGET (vgrid)); gtk_container_add (GTK_CONTAINER (popover), GTK_WIDGET (vgrid)); return popover; } static GtkMenuButton * create_menu_button (TeplPanelSwitcherMenu *switcher) { GtkMenuButton *menu_button; menu_button = GTK_MENU_BUTTON (gtk_menu_button_new ()); gtk_button_set_relief (GTK_BUTTON (menu_button), GTK_RELIEF_NONE); gtk_container_add (GTK_CONTAINER (menu_button), GTK_WIDGET (create_menu_button_title (switcher))); g_assert (switcher->priv->popover == NULL); switcher->priv->popover = create_popover (switcher); gtk_popover_set_relative_to (switcher->priv->popover, GTK_WIDGET (menu_button)); gtk_menu_button_set_popover (menu_button, GTK_WIDGET (switcher->priv->popover)); return menu_button; } static void clear_all (TeplPanelSwitcherMenu *switcher) { GtkWidget *child = gtk_bin_get_child (GTK_BIN (switcher)); if (child != NULL) { gtk_widget_destroy (child); } switcher->priv->popover = NULL; } static void repopulate (TeplPanelSwitcherMenu *switcher) { GtkWidget *child; clear_all (switcher); if (tepl_panel_simple_has_several_items (switcher->priv->panel)) { child = GTK_WIDGET (create_menu_button (switcher)); } else { child = GTK_WIDGET (create_title_label (switcher)); } gtk_widget_show_all (child); gtk_container_add (GTK_CONTAINER (switcher), child); } static void tepl_panel_switcher_menu_dispose (GObject *object) { TeplPanelSwitcherMenu *switcher = TEPL_PANEL_SWITCHER_MENU (object); g_clear_object (&switcher->priv->panel); switcher->priv->popover = NULL; G_OBJECT_CLASS (tepl_panel_switcher_menu_parent_class)->dispose (object); } static void tepl_panel_switcher_menu_class_init (TeplPanelSwitcherMenuClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_panel_switcher_menu_dispose; } static void tepl_panel_switcher_menu_init (TeplPanelSwitcherMenu *switcher) { switcher->priv = tepl_panel_switcher_menu_get_instance_private (switcher); } static void panel_changed_cb (TeplPanelSimple *panel, TeplPanelSwitcherMenu *switcher) { repopulate (switcher); } /** * tepl_panel_switcher_menu_new: * @panel: a #TeplPanelSimple. * * Returns: (transfer floating): a new #TeplPanelSwitcherMenu widget. * Since: 6.11 */ TeplPanelSwitcherMenu * tepl_panel_switcher_menu_new (TeplPanelSimple *panel) { TeplPanelSwitcherMenu *switcher; g_return_val_if_fail (TEPL_IS_PANEL_SIMPLE (panel), NULL); switcher = g_object_new (TEPL_TYPE_PANEL_SWITCHER_MENU, NULL); switcher->priv->panel = g_object_ref (panel); repopulate (switcher); g_signal_connect_object (switcher->priv->panel, "changed", G_CALLBACK (panel_changed_cb), switcher, G_CONNECT_DEFAULT); return switcher; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel-switcher-menu.h000066400000000000000000000033001526404732400301560ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANEL_SWITCHER_MENU_H #define TEPL_PANEL_SWITCHER_MENU_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PANEL_SWITCHER_MENU (tepl_panel_switcher_menu_get_type ()) #define TEPL_PANEL_SWITCHER_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL_SWITCHER_MENU, TeplPanelSwitcherMenu)) #define TEPL_PANEL_SWITCHER_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PANEL_SWITCHER_MENU, TeplPanelSwitcherMenuClass)) #define TEPL_IS_PANEL_SWITCHER_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL_SWITCHER_MENU)) #define TEPL_IS_PANEL_SWITCHER_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PANEL_SWITCHER_MENU)) #define TEPL_PANEL_SWITCHER_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PANEL_SWITCHER_MENU, TeplPanelSwitcherMenuClass)) typedef struct _TeplPanelSwitcherMenu TeplPanelSwitcherMenu; typedef struct _TeplPanelSwitcherMenuClass TeplPanelSwitcherMenuClass; typedef struct _TeplPanelSwitcherMenuPrivate TeplPanelSwitcherMenuPrivate; struct _TeplPanelSwitcherMenu { GtkBin parent; TeplPanelSwitcherMenuPrivate *priv; }; struct _TeplPanelSwitcherMenuClass { GtkBinClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_panel_switcher_menu_get_type (void); G_MODULE_EXPORT TeplPanelSwitcherMenu * tepl_panel_switcher_menu_new (TeplPanelSimple *panel); G_END_DECLS #endif /* TEPL_PANEL_SWITCHER_MENU_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel.c000066400000000000000000000040611526404732400253660ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-panel.h" /** * SECTION:panel * @Title: TeplPanel * @Short_description: Side or bottom panel interface * * #TeplPanel represents a panel that is usually shown on the side or at the * bottom (inside a main window), and can contain several items. */ G_DEFINE_INTERFACE (TeplPanel, tepl_panel, G_TYPE_OBJECT) static void tepl_panel_add_default (TeplPanel *panel, TeplPanelItem *item) { } static void tepl_panel_remove_default (TeplPanel *panel, TeplPanelItem *item) { } static void tepl_panel_set_active_default (TeplPanel *panel, TeplPanelItem *item) { } static void tepl_panel_default_init (TeplPanelInterface *interface) { interface->add = tepl_panel_add_default; interface->remove = tepl_panel_remove_default; interface->set_active = tepl_panel_set_active_default; } /** * tepl_panel_add: * @panel: a #TeplPanel. * @item: a #TeplPanelItem. * * Adds an item to the panel. * * Since: 6.11 */ void tepl_panel_add (TeplPanel *panel, TeplPanelItem *item) { g_return_if_fail (TEPL_IS_PANEL (panel)); g_return_if_fail (TEPL_IS_PANEL_ITEM (item)); TEPL_PANEL_GET_INTERFACE (panel)->add (panel, item); } /** * tepl_panel_remove: * @panel: a #TeplPanel. * @item: the #TeplPanelItem to remove. * * Removes an item from the panel. * * Since: 6.8 */ void tepl_panel_remove (TeplPanel *panel, TeplPanelItem *item) { g_return_if_fail (TEPL_IS_PANEL (panel)); g_return_if_fail (TEPL_IS_PANEL_ITEM (item)); TEPL_PANEL_GET_INTERFACE (panel)->remove (panel, item); } /** * tepl_panel_set_active: * @panel: a #TeplPanel. * @item: (nullable): a #TeplPanelItem. * * Sets @item to be the one that is currently shown in @panel. * * Only one #TeplPanelItem is shown at a time in a #TeplPanel. * * Since: 6.8 */ void tepl_panel_set_active (TeplPanel *panel, TeplPanelItem *item) { g_return_if_fail (TEPL_IS_PANEL (panel)); TEPL_PANEL_GET_INTERFACE (panel)->set_active (panel, item); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel.h000066400000000000000000000035111526404732400253720ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANEL_H #define TEPL_PANEL_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PANEL (tepl_panel_get_type ()) #define TEPL_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL, TeplPanel)) #define TEPL_IS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL)) #define TEPL_PANEL_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEPL_TYPE_PANEL, TeplPanelInterface)) typedef struct _TeplPanel TeplPanel; typedef struct _TeplPanelInterface TeplPanelInterface; /** * TeplPanelInterface: * @parent_interface: The parent interface. * @add: The virtual function pointer for tepl_panel_add(). * By default, does nothing. * @remove: The virtual function pointer for tepl_panel_remove(). * By default, does nothing. * @set_active: The virtual function pointer for tepl_panel_set_active(). * By default, does nothing. * * The virtual function table for #TeplPanel. * * Since: 6.8 */ struct _TeplPanelInterface { GTypeInterface parent_interface; void (*add) (TeplPanel *panel, TeplPanelItem *item); void (*remove) (TeplPanel *panel, TeplPanelItem *item); void (*set_active) (TeplPanel *panel, TeplPanelItem *item); }; G_MODULE_EXPORT GType tepl_panel_get_type (void); G_MODULE_EXPORT void tepl_panel_add (TeplPanel *panel, TeplPanelItem *item); G_MODULE_EXPORT void tepl_panel_remove (TeplPanel *panel, TeplPanelItem *item); G_MODULE_EXPORT void tepl_panel_set_active (TeplPanel *panel, TeplPanelItem *item); G_END_DECLS #endif /* TEPL_PANEL_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel1.c000066400000000000000000000202241526404732400254460ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-panel1.h" #include #include "tepl-utils.h" /** * SECTION:panel1 * @Title: TeplPanel1 * @Short_description: Side or bottom panel container * * #TeplPanel1 permits to create a side or bottom panel that contains several * components. * * #TeplPanel1 is a #GtkGrid subclass containing only one child #GtkWidget by * default: the #GtkStack that can be retrieved with tepl_panel1_get_stack(). * * #TeplPanel1 has the "1" suffix because it's the version 1 of the TeplPanel * API. */ struct _TeplPanel1Private { GtkStack *stack; GSettings *settings; gchar *active_component_setting_key; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplPanel1, tepl_panel1, GTK_TYPE_GRID) static void tepl_panel1_dispose (GObject *object) { TeplPanel1 *panel = TEPL_PANEL1 (object); panel->priv->stack = NULL; g_clear_object (&panel->priv->settings); g_clear_pointer (&panel->priv->active_component_setting_key, g_free); G_OBJECT_CLASS (tepl_panel1_parent_class)->dispose (object); } static void tepl_panel1_class_init (TeplPanel1Class *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_panel1_dispose; } static void tepl_panel1_init (TeplPanel1 *panel) { panel->priv = tepl_panel1_get_instance_private (panel); panel->priv->stack = GTK_STACK (gtk_stack_new ()); gtk_widget_show (GTK_WIDGET (panel->priv->stack)); gtk_container_add (GTK_CONTAINER (panel), GTK_WIDGET (panel->priv->stack)); } /** * tepl_panel1_new: * * Creates a new #TeplPanel1 containing only an empty #GtkStack that can be * retrieved with tepl_panel1_get_stack(). * * Returns: (transfer floating): a new #TeplPanel1. * Since: 5.0 */ TeplPanel1 * tepl_panel1_new (void) { return g_object_new (TEPL_TYPE_PANEL1, NULL); } static void close_button_clicked_cb (GtkButton *close_button, TeplPanel1 *panel) { gtk_widget_hide (GTK_WIDGET (panel)); } static GtkWidget * create_close_button (TeplPanel1 *panel) { GtkWidget *close_button; close_button = tepl_utils_create_close_button (); gtk_widget_set_tooltip_text (close_button, _("Hide panel")); g_signal_connect_object (close_button, "clicked", G_CALLBACK (close_button_clicked_cb), panel, 0); return close_button; } static TeplPanel1 * new_for_side_panel (void) { TeplPanel1 *panel; GtkStackSwitcher *stack_switcher; GtkActionBar *action_bar; panel = tepl_panel1_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (panel), GTK_ORIENTATION_VERTICAL); stack_switcher = GTK_STACK_SWITCHER (gtk_stack_switcher_new ()); gtk_stack_switcher_set_stack (stack_switcher, panel->priv->stack); action_bar = GTK_ACTION_BAR (gtk_action_bar_new ()); gtk_action_bar_set_center_widget (action_bar, GTK_WIDGET (stack_switcher)); gtk_action_bar_pack_end (action_bar, create_close_button (panel)); gtk_grid_attach_next_to (GTK_GRID (panel), GTK_WIDGET (action_bar), GTK_WIDGET (panel->priv->stack), GTK_POS_TOP, 1, 1); gtk_widget_show_all (GTK_WIDGET (panel)); return panel; } /** * tepl_panel1_new_for_left_side_panel: * * Creates a new #TeplPanel1 intended to be used as a side panel added on the * left side inside a #GtkWindow. * * It contains: * - A #GtkStackSwitcher. * - A close button that hides the #TeplPanel1 when clicked. * - A #GtkStack that can be retrieved with tepl_panel1_get_stack(). * * Returns: (transfer floating): a new left side #TeplPanel1. * Since: 5.0 */ TeplPanel1 * tepl_panel1_new_for_left_side_panel (void) { TeplPanel1 *panel; panel = new_for_side_panel (); gtk_widget_set_margin_start (GTK_WIDGET (panel), 6); return panel; } /** * tepl_panel1_get_stack: * @panel: a #TeplPanel1. * * Returns: (transfer none): the #GtkStack widget of @panel (a direct child * #GtkWidget of @panel). * Since: 5.0 */ GtkStack * tepl_panel1_get_stack (TeplPanel1 *panel) { g_return_val_if_fail (TEPL_IS_PANEL1 (panel), NULL); return panel->priv->stack; } /** * tepl_panel1_add_component: * @panel: a #TeplPanel1. * @component: the child #GtkWidget to add to the #GtkStack of @panel. * @name: the name for @component. * @title: a human-readable title for @component. * @icon_name: (nullable): the icon name for @component, or %NULL. * * The equivalent of gtk_stack_add_titled(), with an optional @icon_name to set * the “icon-name” #GtkStack child property. * * Since: 5.0 */ void tepl_panel1_add_component (TeplPanel1 *panel, GtkWidget *component, const gchar *name, const gchar *title, const gchar *icon_name) { g_return_if_fail (TEPL_IS_PANEL1 (panel)); g_return_if_fail (GTK_IS_WIDGET (component)); g_return_if_fail (name != NULL); g_return_if_fail (title != NULL); gtk_stack_add_titled (panel->priv->stack, component, name, title); if (icon_name != NULL) { gtk_container_child_set (GTK_CONTAINER (panel->priv->stack), component, "icon-name", icon_name, NULL); } } /** * tepl_panel1_provide_active_component_gsetting: * @panel: a #TeplPanel1. * @settings: a #GSettings object. * @setting_key: a #GSettings key of type string. * * Provides a #GSettings key for saving and restoring the * #GtkStack:visible-child-name property of the #GtkStack belonging to @panel. * * This function just stores @settings and @setting_key for further use by * tepl_panel1_restore_state_from_gsettings() and * tepl_panel1_save_state_to_gsettings(). It doesn't bind the #GSettings key to * the property, because each main window containing a #TeplPanel1 needs to be * able to have a different state, and have more control over when that state is * restored and saved. Once a #TeplPanel1 is created and fully populated, the * setting can be restored. The setting can be saved according to the current * main window before creating a new main window, and of course on application * exit. * * Note that only one @settings/@setting_key pair is stored by @panel for * further use, if you call this function twice on the same @panel, the second * call overrides the first one. * * Since: 5.0 */ void tepl_panel1_provide_active_component_gsetting (TeplPanel1 *panel, GSettings *settings, const gchar *setting_key) { g_return_if_fail (TEPL_IS_PANEL1 (panel)); g_return_if_fail (G_IS_SETTINGS (settings)); g_return_if_fail (setting_key != NULL); g_set_object (&panel->priv->settings, settings); g_free (panel->priv->active_component_setting_key); panel->priv->active_component_setting_key = g_strdup (setting_key); } /** * tepl_panel1_restore_state_from_gsettings: * @panel: a #TeplPanel1. * * Restores the state of @panel according to the provided #GSettings. * * This function must be called when all components have been added to the * #GtkStack of @panel. * * Since: 5.0 */ void tepl_panel1_restore_state_from_gsettings (TeplPanel1 *panel) { gchar *active_component_name; GtkWidget *child_widget; g_return_if_fail (TEPL_IS_PANEL1 (panel)); if (panel->priv->settings == NULL) { return; } active_component_name = g_settings_get_string (panel->priv->settings, panel->priv->active_component_setting_key); child_widget = gtk_stack_get_child_by_name (panel->priv->stack, active_component_name); /* If child_widget is NULL, do nothing, and do not print an error. It * can happen if it's an old GSettings value and the child in the * GtkStack no longer exists after an upgrade of the application. */ if (child_widget != NULL) { gtk_stack_set_visible_child (panel->priv->stack, child_widget); } g_free (active_component_name); } /** * tepl_panel1_save_state_to_gsettings: * @panel: a #TeplPanel1. * * Saves the current state of @panel to the provided #GSettings. * * Since: 5.0 */ void tepl_panel1_save_state_to_gsettings (TeplPanel1 *panel) { const gchar *visible_child_name; g_return_if_fail (TEPL_IS_PANEL1 (panel)); if (panel->priv->settings == NULL) { return; } visible_child_name = gtk_stack_get_visible_child_name (panel->priv->stack); if (visible_child_name != NULL) { g_settings_set_string (panel->priv->settings, panel->priv->active_component_setting_key, visible_child_name); } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-panel1.h000066400000000000000000000037511526404732400254610ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANEL1_H #define TEPL_PANEL1_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PANEL1 (tepl_panel1_get_type ()) #define TEPL_PANEL1(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL1, TeplPanel1)) #define TEPL_PANEL1_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PANEL1, TeplPanel1Class)) #define TEPL_IS_PANEL1(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL1)) #define TEPL_IS_PANEL1_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PANEL1)) #define TEPL_PANEL1_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PANEL1, TeplPanel1Class)) typedef struct _TeplPanel1 TeplPanel1; typedef struct _TeplPanel1Class TeplPanel1Class; typedef struct _TeplPanel1Private TeplPanel1Private; struct _TeplPanel1 { GtkGrid parent; TeplPanel1Private *priv; }; struct _TeplPanel1Class { GtkGridClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_panel1_get_type (void); G_MODULE_EXPORT TeplPanel1 * tepl_panel1_new (void); G_MODULE_EXPORT TeplPanel1 * tepl_panel1_new_for_left_side_panel (void); G_MODULE_EXPORT GtkStack * tepl_panel1_get_stack (TeplPanel1 *panel); G_MODULE_EXPORT void tepl_panel1_add_component (TeplPanel1 *panel, GtkWidget *component, const gchar *name, const gchar *title, const gchar *icon_name); G_MODULE_EXPORT void tepl_panel1_provide_active_component_gsetting (TeplPanel1 *panel, GSettings *settings, const gchar *setting_key); G_MODULE_EXPORT void tepl_panel1_restore_state_from_gsettings (TeplPanel1 *panel); G_MODULE_EXPORT void tepl_panel1_save_state_to_gsettings (TeplPanel1 *panel); G_END_DECLS #endif /* TEPL_PANEL1_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-pango.c000066400000000000000000000150601526404732400253740ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016 - Matthias Clasen * SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ /** * SECTION:pango * @Title: TeplPango * @Short_description: Pango utility functions * * Utility functions related to the Pango library. */ /* The code is taken from pango_font_description_to_css(), gtkfontbutton.c, GTK. */ #include "tepl-pango.h" static void add_css_variations (GString *s, const char *variations) { const char *p; const char *sep = ""; if (variations == NULL || variations[0] == '\0') { g_string_append (s, "normal"); return; } p = variations; while (p && *p) { const char *start; const char *end, *end2; double value; char name[5]; while (g_ascii_isspace (*p)) p++; start = p; end = strchr (p, ','); if (end && (end - p < 6)) goto skip; name[0] = p[0]; name[1] = p[1]; name[2] = p[2]; name[3] = p[3]; name[4] = '\0'; p += 4; while (g_ascii_isspace (*p)) p++; if (*p == '=') p++; if (p - start < 5) goto skip; value = g_ascii_strtod (p, (char **) &end2); while (end2 && g_ascii_isspace (*end2)) end2++; if (end2 && (*end2 != ',' && *end2 != '\0')) goto skip; g_string_append_printf (s, "%s\"%s\" %g", sep, name, value); sep = ", "; skip: p = end ? end + 1 : NULL; } } /** * tepl_pango_font_description_to_css: * @desc: a #PangoFontDescription. * * This function will generate CSS suitable for the GTK CSS engine based on the * properties of the #PangoFontDescription. * * The returned string contains only the CSS declarations, it is not a complete * CSS rule set. So the selector and curly braces are not present. Each * declaration, including the last one, ends with a semicolon. * * See also tepl_utils_override_font_description() and * tepl_utils_override_font_string(). * * Returns: (transfer full): A newly allocated string containing the CSS * describing the font description. Free with g_free() when no longer needed. * Since: 6.0 */ gchar * tepl_pango_font_description_to_css (const PangoFontDescription *desc) { GString *s; PangoFontMask set; g_return_val_if_fail (desc != NULL, NULL); s = g_string_new (""); set = pango_font_description_get_set_fields (desc); if (set & PANGO_FONT_MASK_FAMILY) { g_string_append (s, "font-family: \""); g_string_append (s, pango_font_description_get_family (desc)); g_string_append (s, "\"; "); } if (set & PANGO_FONT_MASK_STYLE) { switch (pango_font_description_get_style (desc)) { case PANGO_STYLE_NORMAL: g_string_append (s, "font-style: normal; "); break; case PANGO_STYLE_OBLIQUE: g_string_append (s, "font-style: oblique; "); break; case PANGO_STYLE_ITALIC: g_string_append (s, "font-style: italic; "); break; default: break; } } if (set & PANGO_FONT_MASK_VARIANT) { switch (pango_font_description_get_variant (desc)) { case PANGO_VARIANT_NORMAL: g_string_append (s, "font-variant: normal; "); break; case PANGO_VARIANT_SMALL_CAPS: g_string_append (s, "font-variant: small-caps; "); break; /* Currently the GTK 3 CSS engine only supports CSS2 values for the * font-variant property. */ case PANGO_VARIANT_ALL_SMALL_CAPS: case PANGO_VARIANT_PETITE_CAPS: case PANGO_VARIANT_ALL_PETITE_CAPS: case PANGO_VARIANT_UNICASE: case PANGO_VARIANT_TITLE_CAPS: default: break; } } if (set & PANGO_FONT_MASK_WEIGHT) { switch (pango_font_description_get_weight (desc)) { case PANGO_WEIGHT_THIN: g_string_append (s, "font-weight: 100; "); break; case PANGO_WEIGHT_ULTRALIGHT: g_string_append (s, "font-weight: 200; "); break; case PANGO_WEIGHT_LIGHT: case PANGO_WEIGHT_SEMILIGHT: g_string_append (s, "font-weight: 300; "); break; case PANGO_WEIGHT_BOOK: case PANGO_WEIGHT_NORMAL: g_string_append (s, "font-weight: 400; "); break; case PANGO_WEIGHT_MEDIUM: g_string_append (s, "font-weight: 500; "); break; case PANGO_WEIGHT_SEMIBOLD: g_string_append (s, "font-weight: 600; "); break; case PANGO_WEIGHT_BOLD: g_string_append (s, "font-weight: 700; "); break; case PANGO_WEIGHT_ULTRABOLD: g_string_append (s, "font-weight: 800; "); break; case PANGO_WEIGHT_HEAVY: case PANGO_WEIGHT_ULTRAHEAVY: g_string_append (s, "font-weight: 900; "); break; default: break; } } if (set & PANGO_FONT_MASK_STRETCH) { switch (pango_font_description_get_stretch (desc)) { case PANGO_STRETCH_ULTRA_CONDENSED: g_string_append (s, "font-stretch: ultra-condensed; "); break; case PANGO_STRETCH_EXTRA_CONDENSED: g_string_append (s, "font-stretch: extra-condensed; "); break; case PANGO_STRETCH_CONDENSED: g_string_append (s, "font-stretch: condensed; "); break; case PANGO_STRETCH_SEMI_CONDENSED: g_string_append (s, "font-stretch: semi-condensed; "); break; case PANGO_STRETCH_NORMAL: g_string_append (s, "font-stretch: normal; "); break; case PANGO_STRETCH_SEMI_EXPANDED: g_string_append (s, "font-stretch: semi-expanded; "); break; case PANGO_STRETCH_EXPANDED: g_string_append (s, "font-stretch: expanded; "); break; case PANGO_STRETCH_EXTRA_EXPANDED: break; case PANGO_STRETCH_ULTRA_EXPANDED: g_string_append (s, "font-stretch: ultra-expanded; "); break; default: break; } } if (set & PANGO_FONT_MASK_SIZE) { g_string_append_printf (s, "font-size: %dpt; ", pango_font_description_get_size (desc) / PANGO_SCALE); } if (set & PANGO_FONT_MASK_VARIATIONS) { const char *variations; g_string_append (s, "font-variation-settings: "); variations = pango_font_description_get_variations (desc); add_css_variations (s, variations); g_string_append (s, "; "); } return g_string_free (s, FALSE); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-pango.h000066400000000000000000000007461526404732400254060ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PANGO_H #define TEPL_PANGO_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS G_MODULE_EXPORT gchar * tepl_pango_font_description_to_css (const PangoFontDescription *desc); G_END_DECLS #endif /* TEPL_PANGO_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-prefs-dialog.c000066400000000000000000000152431526404732400266470ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-prefs-dialog.h" #include #include "tepl-abstract-factory.h" /** * SECTION:prefs-dialog * @Short_description: Preferences dialog * @Title: TeplPrefsDialog * * #TeplPrefsDialog is a subclass of #GtkDialog for configuring the preferences * of an application. */ /* By sub-classing GtkDialog, there is the Escape keyboard shortcut to close the * dialog (which is what we want). */ struct _TeplPrefsDialogPrivate { gint something; }; enum { SIGNAL_RESET_ALL, N_SIGNALS }; static guint signals[N_SIGNALS]; static TeplPrefsDialog *singleton = NULL; G_DEFINE_TYPE_WITH_PRIVATE (TeplPrefsDialog, tepl_prefs_dialog, GTK_TYPE_DIALOG) static void tepl_prefs_dialog_finalize (GObject *object) { if (singleton == TEPL_PREFS_DIALOG (object)) { singleton = NULL; } G_OBJECT_CLASS (tepl_prefs_dialog_parent_class)->finalize (object); } static gboolean tepl_prefs_dialog_delete_event (GtkWidget *widget, GdkEventAny *event) { gtk_widget_hide (widget); return GDK_EVENT_STOP; } static void tepl_prefs_dialog_class_init (TeplPrefsDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->finalize = tepl_prefs_dialog_finalize; widget_class->delete_event = tepl_prefs_dialog_delete_event; /** * TeplPrefsDialog::reset-all: * @prefs_dialog: the #TeplPrefsDialog emitting the signal. * * The ::reset-all signal is emitted when the user has requested to * reset all preferences. * * Applications should connect to this signal to perform the operation. * tepl_settings_reset_all() may be useful for that. * * See tepl_prefs_dialog_add_reset_all_button(). * * Since: 6.13 */ signals[SIGNAL_RESET_ALL] = g_signal_new ("reset-all", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0); } static void tepl_prefs_dialog_init (TeplPrefsDialog *dialog) { GtkWidget *content_area; dialog->priv = tepl_prefs_dialog_get_instance_private (dialog); gtk_window_set_title (GTK_WINDOW (dialog), _("Preferences")); /* Ideally this should be hide-when-parent-destroyed, but it isn't * implemented by GTK. A utils function could be implemented, but it's * more code (so more chances to get it wrong), and it doesn't really * worth it. * * So, keep things simple. * * When the app has several main windows opened, but on different * workspaces, it would be strange to keep the TeplPrefsDialog visible * when its parent is closed. So it needs to be hidden or destroyed. * Hidden is slightly better because a preferences dialog usually has a * GtkNotebook inside (or something similar), so it's better to keep the * same tab when showing again the preferences dialog. */ gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); /* When packing a GtkNotebook inside the content area, we don't want any * margin around the GtkNotebook. More generally, we can also control * the margins that we want with what we pack into the content area. */ gtk_container_set_border_width (GTK_CONTAINER (content_area), 0); } /** * tepl_prefs_dialog_new: * * Returns: (transfer floating): a new #TeplPrefsDialog. * Since: 6.13 */ TeplPrefsDialog * tepl_prefs_dialog_new (void) { return g_object_new (TEPL_TYPE_PREFS_DIALOG, "use-header-bar", TRUE, NULL); } /** * tepl_prefs_dialog_get_singleton: * * The singleton instance is created with * tepl_abstract_factory_create_prefs_dialog(). * * Returns: (transfer none): the #TeplPrefsDialog singleton instance. * Since: 6.2 */ TeplPrefsDialog * tepl_prefs_dialog_get_singleton (void) { if (singleton == NULL) { TeplAbstractFactory *factory; factory = tepl_abstract_factory_get_singleton (); singleton = tepl_abstract_factory_create_prefs_dialog (factory); } return singleton; } void _tepl_prefs_dialog_unref_singleton (void) { if (singleton != NULL) { gtk_widget_destroy (GTK_WIDGET (singleton)); } } /** * tepl_prefs_dialog_show_for_parent: * @dialog: a #TeplPrefsDialog. * @parent_window: the parent #GtkWindow. * * This function sets the #GtkWindow:transient-for property and presents * @dialog. * * Since: 6.2 */ void tepl_prefs_dialog_show_for_parent (TeplPrefsDialog *dialog, GtkWindow *parent_window) { g_return_if_fail (TEPL_IS_PREFS_DIALOG (dialog)); g_return_if_fail (GTK_IS_WINDOW (parent_window)); gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window); gtk_window_present (GTK_WINDOW (dialog)); } static void reset_all_confirm_dialog_response_cb (GtkDialog *confirm_dialog, gint response_id, TeplPrefsDialog *dialog) { if (response_id == GTK_RESPONSE_YES) { g_signal_emit (dialog, signals[SIGNAL_RESET_ALL], 0); } gtk_widget_destroy (GTK_WIDGET (confirm_dialog)); } static void reset_button_clicked_cb (GtkButton *reset_button, TeplPrefsDialog *dialog) { GtkWidget *confirm_dialog; confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Do you really want to reset all preferences?")); gtk_dialog_add_button (GTK_DIALOG (confirm_dialog), _("_Cancel"), GTK_RESPONSE_CANCEL); gtk_dialog_add_button (GTK_DIALOG (confirm_dialog), _("_Reset All"), GTK_RESPONSE_YES); g_signal_connect_object (confirm_dialog, "response", G_CALLBACK (reset_all_confirm_dialog_response_cb), dialog, G_CONNECT_DEFAULT); gtk_widget_show_all (confirm_dialog); } /** * tepl_prefs_dialog_add_reset_all_button: * @dialog: a #TeplPrefsDialog. * * Adds a “Reset All” button. When the button is clicked and the user confirms, * the #TeplPrefsDialog::reset-all signal is emitted. * * Since: 6.13 */ void tepl_prefs_dialog_add_reset_all_button (TeplPrefsDialog *dialog) { GtkWidget *header_bar; GtkWidget *reset_button; g_return_if_fail (TEPL_IS_PREFS_DIALOG (dialog)); header_bar = gtk_dialog_get_header_bar (GTK_DIALOG (dialog)); g_return_if_fail (header_bar != NULL); reset_button = gtk_button_new_with_mnemonic (_("_Reset All…")); gtk_widget_set_tooltip_text (reset_button, _("Reset all preferences")); gtk_widget_show (reset_button); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), reset_button); g_signal_connect_object (reset_button, "clicked", G_CALLBACK (reset_button_clicked_cb), dialog, G_CONNECT_DEFAULT); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-prefs-dialog.h000066400000000000000000000035351526404732400266550ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PREFS_DIALOG_H #define TEPL_PREFS_DIALOG_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_PREFS_DIALOG (tepl_prefs_dialog_get_type ()) #define TEPL_PREFS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PREFS_DIALOG, TeplPrefsDialog)) #define TEPL_PREFS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PREFS_DIALOG, TeplPrefsDialogClass)) #define TEPL_IS_PREFS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PREFS_DIALOG)) #define TEPL_IS_PREFS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PREFS_DIALOG)) #define TEPL_PREFS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PREFS_DIALOG, TeplPrefsDialogClass)) typedef struct _TeplPrefsDialog TeplPrefsDialog; typedef struct _TeplPrefsDialogClass TeplPrefsDialogClass; typedef struct _TeplPrefsDialogPrivate TeplPrefsDialogPrivate; struct _TeplPrefsDialog { GtkDialog parent; TeplPrefsDialogPrivate *priv; }; struct _TeplPrefsDialogClass { GtkDialogClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_prefs_dialog_get_type (void); G_MODULE_EXPORT TeplPrefsDialog * tepl_prefs_dialog_new (void); G_MODULE_EXPORT TeplPrefsDialog * tepl_prefs_dialog_get_singleton (void); G_GNUC_INTERNAL void _tepl_prefs_dialog_unref_singleton (void); G_MODULE_EXPORT void tepl_prefs_dialog_show_for_parent (TeplPrefsDialog *dialog, GtkWindow *parent_window); G_MODULE_EXPORT void tepl_prefs_dialog_add_reset_all_button (TeplPrefsDialog *dialog); G_END_DECLS #endif /* TEPL_PREFS_DIALOG_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-prefs.c000066400000000000000000000424251526404732400254140ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-prefs.h" #include #include #include "tepl-settings.h" #include "tepl-utils.h" /** * SECTION:prefs * @Short_description: Preferences widgets to configure a text editor * @Title: TeplPrefs * * Functions to create GUI elements that are useful for a preferences dialog or * panel. In order to configure a text editor. */ /* TODO: possibility to use the "dialog-question-symbolic" icon and set a * tooltip to it to provide more infos for an item. */ #define SETTING_SYSTEM_FONT_KEY "monospace-font-name" /** * tepl_prefs_create_checkbutton_simple: * @settings: a #GSettings. * @key: a key part of @settings. The type of the key must be a boolean. * @mnemonic_text: the text (with mnemonic) for the #GtkCheckButton. * * Returns: (transfer floating): a #GtkCheckButton to configure @key. * Since: 6.13 */ GtkWidget * tepl_prefs_create_checkbutton_simple (GSettings *settings, const gchar *key, const gchar *mnemonic_text) { GtkWidget *checkbutton; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (mnemonic_text != NULL, NULL); checkbutton = gtk_check_button_new_with_mnemonic (mnemonic_text); gtk_widget_show (checkbutton); g_settings_bind (settings, key, checkbutton, "active", G_SETTINGS_BIND_DEFAULT); return checkbutton; } static void update_default_font_checkbutton_label (GtkCheckButton *checkbutton) { TeplSettings *settings; GSettings *desktop_interface_settings; gchar *monospace_font_name; gchar *label; settings = tepl_settings_get_singleton (); desktop_interface_settings = tepl_settings_peek_desktop_interface_settings (settings); monospace_font_name = g_settings_get_string (desktop_interface_settings, SETTING_SYSTEM_FONT_KEY); label = g_strdup_printf (_("_Use the system fixed width font (%s)"), monospace_font_name); gtk_button_set_label (GTK_BUTTON (checkbutton), label); gtk_button_set_use_underline (GTK_BUTTON (checkbutton), TRUE); g_free (monospace_font_name); g_free (label); } static void system_font_changed_cb (GSettings *desktop_interface_settings, gchar *key, gpointer user_data) { GtkCheckButton *default_font_checkbutton = GTK_CHECK_BUTTON (user_data); update_default_font_checkbutton_label (default_font_checkbutton); } static GtkWidget * create_default_font_checkbutton (void) { GtkWidget *default_font_checkbutton; TeplSettings *settings; GSettings *desktop_interface_settings; default_font_checkbutton = gtk_check_button_new (); update_default_font_checkbutton_label (GTK_CHECK_BUTTON (default_font_checkbutton)); settings = tepl_settings_get_singleton (); desktop_interface_settings = tepl_settings_peek_desktop_interface_settings (settings); g_signal_connect_object (desktop_interface_settings, "changed::" SETTING_SYSTEM_FONT_KEY, G_CALLBACK (system_font_changed_cb), default_font_checkbutton, 0); return default_font_checkbutton; } /** * tepl_prefs_create_font_component: * @settings: a #GSettings. * @use_default_font_key: a key part of @settings to store whether to use the * system font. The type of the key must be a boolean. * @editor_font_key: a key part of @settings to store the editor font. The type * of the key must be a string. * * Returns: (transfer floating): A component for configuring the font. * Since: 6.2 */ GtkWidget * tepl_prefs_create_font_component (GSettings *settings, const gchar *use_default_font_key, const gchar *editor_font_key) { GtkWidget *default_font_checkbutton; GtkWidget *label; GtkWidget *font_button; GtkWidget *vgrid; GtkWidget *hgrid; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (use_default_font_key != NULL, NULL); g_return_val_if_fail (editor_font_key != NULL, NULL); /* Widgets */ default_font_checkbutton = create_default_font_checkbutton (); label = gtk_label_new_with_mnemonic (_("Editor _font:")); font_button = gtk_font_button_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), font_button); /* GSettings */ g_settings_bind (settings, use_default_font_key, default_font_checkbutton, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (settings, editor_font_key, font_button, "font", G_SETTINGS_BIND_DEFAULT); /* Packing */ vgrid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 6); gtk_container_add (GTK_CONTAINER (vgrid), default_font_checkbutton); hgrid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (hgrid), 12); gtk_container_add (GTK_CONTAINER (hgrid), label); gtk_container_add (GTK_CONTAINER (hgrid), font_button); gtk_container_add (GTK_CONTAINER (vgrid), hgrid); /* Sensitivity */ g_object_bind_property (default_font_checkbutton, "active", hgrid, "sensitive", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); return tepl_utils_get_titled_component (_("Font"), vgrid); } /** * tepl_prefs_create_display_line_numbers_checkbutton: * @settings: a #GSettings. * @display_line_numbers_key: a key part of @settings. The type of the key must * be a boolean. * * Returns: (transfer floating): A #GtkCheckButton intended for * #GtkSourceView:show-line-numbers. * Since: 6.2 */ GtkWidget * tepl_prefs_create_display_line_numbers_checkbutton (GSettings *settings, const gchar *display_line_numbers_key) { return tepl_prefs_create_checkbutton_simple (settings, display_line_numbers_key, _("_Display line numbers")); } /** * tepl_prefs_create_tab_width_spinbutton: * @settings: a #GSettings. * @tab_width_key: a key part of @settings. The type of the key must be an * unsigned integer, with a range. * * Returns: (transfer floating): A widget containing a #GtkSpinButton intended * for #GtkSourceView:tab-width. * Since: 6.2 */ GtkWidget * tepl_prefs_create_tab_width_spinbutton (GSettings *settings, const gchar *tab_width_key) { guint32 min = 0; guint32 max = 0; gboolean success; GtkWidget *label; GtkWidget *spinbutton; GtkWidget *hgrid; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (tab_width_key != NULL, NULL); success = tepl_settings_get_range_uint (settings, tab_width_key, &min, &max); g_return_val_if_fail (success, NULL); label = gtk_label_new_with_mnemonic (_("_Tab width:")); spinbutton = gtk_spin_button_new_with_range (min, max, 1.0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton); g_settings_bind (settings, tab_width_key, spinbutton, "value", G_SETTINGS_BIND_DEFAULT); /* Packing */ hgrid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (hgrid), 6); gtk_container_add (GTK_CONTAINER (hgrid), label); gtk_container_add (GTK_CONTAINER (hgrid), spinbutton); gtk_widget_show_all (hgrid); return hgrid; } /** * tepl_prefs_create_insert_spaces_component: * @settings: a #GSettings. * @insert_spaces_key: a key part of @settings. The type of the key must be a * boolean. * @smart_backspace_key: a key part of @settings. The type of the key must be a * boolean. * * Returns: (transfer floating): a component intended for * #GtkSourceView:insert-spaces-instead-of-tabs and * #GtkSourceView:smart-backspace. * Since: 6.2 */ GtkWidget * tepl_prefs_create_insert_spaces_component (GSettings *settings, const gchar *insert_spaces_key, const gchar *smart_backspace_key) { GtkWidget *insert_spaces_checkbutton; GtkWidget *smart_backspace_checkbutton; GtkWidget *vgrid; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (insert_spaces_key != NULL, NULL); g_return_val_if_fail (smart_backspace_key != NULL, NULL); insert_spaces_checkbutton = tepl_prefs_create_checkbutton_simple (settings, insert_spaces_key, _("Insert _spaces instead of tabs")); smart_backspace_checkbutton = tepl_prefs_create_checkbutton_simple (settings, smart_backspace_key, _("_Forget you are not using tabulations")); gtk_widget_set_margin_start (smart_backspace_checkbutton, 12); g_object_bind_property (insert_spaces_checkbutton, "active", smart_backspace_checkbutton, "sensitive", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); /* Packing */ vgrid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 7); gtk_container_add (GTK_CONTAINER (vgrid), insert_spaces_checkbutton); gtk_container_add (GTK_CONTAINER (vgrid), smart_backspace_checkbutton); gtk_widget_show_all (vgrid); return vgrid; } /** * tepl_prefs_create_highlighting_component: * @settings: a #GSettings. * @highlight_current_line_key: a key part of @settings. The type of the key * must be a boolean. * @highlight_matching_brackets_key: a key part of @settings. The type of the * key must be a boolean. * * Returns: (transfer floating): a component intended for * #GtkSourceView:highlight-current-line and * #GtkSourceBuffer:highlight-matching-brackets. * Since: 6.2 */ GtkWidget * tepl_prefs_create_highlighting_component (GSettings *settings, const gchar *highlight_current_line_key, const gchar *highlight_matching_brackets_key) { GtkWidget *vgrid; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (highlight_current_line_key != NULL, NULL); g_return_val_if_fail (highlight_matching_brackets_key != NULL, NULL); vgrid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 7); gtk_container_add (GTK_CONTAINER (vgrid), tepl_prefs_create_checkbutton_simple (settings, highlight_current_line_key, _("Highlight current _line"))); gtk_container_add (GTK_CONTAINER (vgrid), tepl_prefs_create_checkbutton_simple (settings, highlight_matching_brackets_key, _("Highlight matching _brackets"))); return tepl_utils_get_titled_component (_("Highlighting"), vgrid); } static GtkWidget * create_auto_save_component (GSettings *settings, const gchar *auto_save_key, const gchar *auto_save_interval) { guint32 min = 0; guint32 max = 0; gboolean success; GtkWidget *checkbutton; GtkWidget *label; GtkWidget *spinbutton; GtkWidget *vgrid; GtkWidget *hgrid; /* Widgets */ success = tepl_settings_get_range_uint (settings, auto_save_interval, &min, &max); g_return_val_if_fail (success, NULL); checkbutton = tepl_prefs_create_checkbutton_simple (settings, auto_save_key, _("_Autosave files")); label = gtk_label_new_with_mnemonic (_("Time in _minutes between each autosave:")); spinbutton = gtk_spin_button_new_with_range (min, max, 1.0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton); g_settings_bind (settings, auto_save_interval, spinbutton, "value", G_SETTINGS_BIND_DEFAULT); /* Packing */ vgrid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 7); gtk_container_add (GTK_CONTAINER (vgrid), checkbutton); hgrid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (hgrid), 6); gtk_widget_set_margin_start (hgrid, 12); gtk_container_add (GTK_CONTAINER (hgrid), label); gtk_container_add (GTK_CONTAINER (hgrid), spinbutton); gtk_container_add (GTK_CONTAINER (vgrid), hgrid); gtk_widget_show_all (vgrid); /* Sensitivity */ g_object_bind_property (checkbutton, "active", hgrid, "sensitive", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); return vgrid; } /** * tepl_prefs_create_files_component: * @settings: a #GSettings. * @create_backup_copy_key: a key part of @settings. The type of the key must be * a boolean. Intended to be used with %TEPL_FILE_SAVER_FLAGS_CREATE_BACKUP * (for example). * @auto_save_key: a key part of @settings. The type of the key must be a * boolean. Whether to autosave files. * @auto_save_interval: a key part of @settings. The type of the key must be an * unsigned integer, with a range. The interval is in minutes. * * Returns: (transfer floating): a component for some files preferences. * Since: 6.2 */ GtkWidget * tepl_prefs_create_files_component (GSettings *settings, const gchar *create_backup_copy_key, const gchar *auto_save_key, const gchar *auto_save_interval) { GtkWidget *vgrid; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (create_backup_copy_key != NULL, NULL); g_return_val_if_fail (auto_save_key != NULL, NULL); g_return_val_if_fail (auto_save_interval != NULL, NULL); vgrid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 7); gtk_container_add (GTK_CONTAINER (vgrid), tepl_prefs_create_checkbutton_simple (settings, create_backup_copy_key, _("_Create a backup copy of files before saving"))); gtk_container_add (GTK_CONTAINER (vgrid), create_auto_save_component (settings, auto_save_key, auto_save_interval)); return tepl_utils_get_titled_component (_("Files"), vgrid); } /** * tepl_prefs_create_theme_variant_combo_box: * @settings: a #GSettings. * @theme_variant_key: a key part of @settings. Its type must be an enum for * #TeplSettingsThemeVariant. * * Returns: (transfer floating): A widget containing a #GtkComboBoxText intended * to choose a #TeplSettingsThemeVariant. * Since: 6.10 */ GtkWidget * tepl_prefs_create_theme_variant_combo_box (GSettings *settings, const gchar *theme_variant_key) { GtkComboBoxText *combo_box_text; HdyStyleManager *style_manager; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (theme_variant_key != NULL, NULL); combo_box_text = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new ()); gtk_widget_show (GTK_WIDGET (combo_box_text)); gtk_widget_set_halign (GTK_WIDGET (combo_box_text), GTK_ALIGN_START); style_manager = hdy_style_manager_get_default (); if (hdy_style_manager_get_system_supports_color_schemes (style_manager)) { gtk_combo_box_text_append (combo_box_text, "system", _("Follow system style")); } gtk_combo_box_text_append (combo_box_text, "light", _("Light style")); gtk_combo_box_text_append (combo_box_text, "dark", _("Dark style")); g_settings_bind (settings, theme_variant_key, combo_box_text, "active-id", G_SETTINGS_BIND_DEFAULT); return tepl_utils_get_titled_component (_("Theme Variant"), GTK_WIDGET (combo_box_text)); } /** * tepl_prefs_create_right_margin_component: * @settings: a #GSettings. * @display_right_margin_key: a key part of @settings. The type of the key must * be a boolean. * @right_margin_position_key: a key part of @settings. The type of the key must * be an unsigned integer. * * Returns: (transfer floating): a component intended for * #GtkSourceView:show-right-margin and #GtkSourceView:right-margin-position. * Since: 6.10 */ GtkWidget * tepl_prefs_create_right_margin_component (GSettings *settings, const gchar *display_right_margin_key, const gchar *right_margin_position_key) { GtkWidget *check_button; GtkWidget *spin_button; GtkGrid *spin_button_wrapper; GtkGrid *hgrid; g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (display_right_margin_key != NULL, NULL); g_return_val_if_fail (right_margin_position_key != NULL, NULL); /* Check button */ check_button = tepl_prefs_create_checkbutton_simple (settings, display_right_margin_key, _("Display right _margin at column:")); /* Spin button */ spin_button = gtk_spin_button_new_with_range (1.0, 1000.0, 1.0); // Note that this creates a binding between the writability of the // GSettings key with the "sensitive" property of the spin_button. // Hence the need for spin_button_wrapper. g_settings_bind (settings, right_margin_position_key, spin_button, "value", G_SETTINGS_BIND_DEFAULT); /* Sensitivity */ spin_button_wrapper = GTK_GRID (gtk_grid_new ()); gtk_container_add (GTK_CONTAINER (spin_button_wrapper), spin_button); g_object_bind_property (check_button, "active", spin_button_wrapper, "sensitive", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); /* Main packing */ hgrid = GTK_GRID (gtk_grid_new ()); gtk_grid_set_column_spacing (hgrid, 6); gtk_container_add (GTK_CONTAINER (hgrid), check_button); gtk_container_add (GTK_CONTAINER (hgrid), GTK_WIDGET (spin_button_wrapper)); gtk_widget_show_all (GTK_WIDGET (hgrid)); return GTK_WIDGET (hgrid); } /** * tepl_prefs_create_display_statusbar_checkbutton: * @settings: a #GSettings. * @display_statusbar_key: a key part of @settings. The type of the key must be * a boolean. * * Returns: (transfer floating): A #GtkCheckButton intended for configuring the * visibility of a #GtkStatusbar. * Since: 6.10 */ GtkWidget * tepl_prefs_create_display_statusbar_checkbutton (GSettings *settings, const gchar *display_statusbar_key) { g_return_val_if_fail (G_IS_SETTINGS (settings), NULL); g_return_val_if_fail (display_statusbar_key != NULL, NULL); return tepl_prefs_create_checkbutton_simple (settings, display_statusbar_key, _("Display _statusbar")); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-prefs.h000066400000000000000000000040341526404732400254130ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PREFS_H #define TEPL_PREFS_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT GtkWidget * tepl_prefs_create_checkbutton_simple (GSettings *settings, const gchar *key, const gchar *mnemonic_text); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_font_component (GSettings *settings, const gchar *use_default_font_key, const gchar *editor_font_key); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_display_line_numbers_checkbutton (GSettings *settings, const gchar *display_line_numbers_key); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_tab_width_spinbutton (GSettings *settings, const gchar *tab_width_key); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_insert_spaces_component (GSettings *settings, const gchar *insert_spaces_key, const gchar *smart_backspace_key); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_highlighting_component (GSettings *settings, const gchar *highlight_current_line_key, const gchar *highlight_matching_brackets_key); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_files_component (GSettings *settings, const gchar *create_backup_copy_key, const gchar *auto_save_key, const gchar *auto_save_interval); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_theme_variant_combo_box (GSettings *settings, const gchar *theme_variant_key); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_right_margin_component (GSettings *settings, const gchar *display_right_margin_key, const gchar *right_margin_position_key); G_MODULE_EXPORT GtkWidget * tepl_prefs_create_display_statusbar_checkbutton (GSettings *settings, const gchar *display_statusbar_key); G_END_DECLS #endif /* TEPL_PREFS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-progress-info-bar.c000066400000000000000000000153241526404732400276320ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2005 - Paolo Maggi * SPDX-FileCopyrightText: 2016, 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ /* Inspired by GeditProgressInfoBar. */ #include "config.h" #include "tepl-progress-info-bar.h" #include /** * SECTION:progress-info-bar * @Title: TeplProgressInfoBar * @Short_description: A #TeplInfoBar containing a #GtkProgressBar * * #TeplProgressInfoBar is a #TeplInfoBar containing a #GtkProgressBar and a * #GtkLabel. As every #TeplInfoBar it can also contain an icon, and other * widgets can be added by the application as well. * * The #GtkLabel content can be modified after the #TeplProgressInfoBar has been * created. */ struct _TeplProgressInfoBarPrivate { GtkLabel *label; GtkProgressBar *progress_bar; guint has_cancel_button : 1; }; enum { PROP_0, PROP_HAS_CANCEL_BUTTON, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplProgressInfoBar, tepl_progress_info_bar, TEPL_TYPE_INFO_BAR) static void set_has_cancel_button (TeplProgressInfoBar *info_bar, gboolean has_cancel_button) { info_bar->priv->has_cancel_button = has_cancel_button != FALSE; if (has_cancel_button) { gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Cancel"), GTK_RESPONSE_CANCEL); } } static void tepl_progress_info_bar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplProgressInfoBar *info_bar = TEPL_PROGRESS_INFO_BAR (object); switch (prop_id) { case PROP_HAS_CANCEL_BUTTON: g_value_set_boolean (value, info_bar->priv->has_cancel_button); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_progress_info_bar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplProgressInfoBar *info_bar = TEPL_PROGRESS_INFO_BAR (object); switch (prop_id) { case PROP_HAS_CANCEL_BUTTON: set_has_cancel_button (info_bar, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_progress_info_bar_dispose (GObject *object) { TeplProgressInfoBar *info_bar = TEPL_PROGRESS_INFO_BAR (object); info_bar->priv->label = NULL; info_bar->priv->progress_bar = NULL; G_OBJECT_CLASS (tepl_progress_info_bar_parent_class)->dispose (object); } static void tepl_progress_info_bar_class_init (TeplProgressInfoBarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_progress_info_bar_get_property; object_class->set_property = tepl_progress_info_bar_set_property; object_class->dispose = tepl_progress_info_bar_dispose; /** * TeplProgressInfoBar:has-cancel-button: * * Whether to add a Cancel button in the action area of the #GtkInfoBar, * with the %GTK_RESPONSE_CANCEL response. * * Since: 6.0 */ properties[PROP_HAS_CANCEL_BUTTON] = g_param_spec_boolean ("has-cancel-button", "has-cancel-button", "", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_progress_info_bar_init (TeplProgressInfoBar *info_bar) { info_bar->priv = tepl_progress_info_bar_get_instance_private (info_bar); info_bar->priv->label = tepl_info_bar_create_label (); gtk_widget_show (GTK_WIDGET (info_bar->priv->label)); tepl_info_bar_add_content_widget (TEPL_INFO_BAR (info_bar), GTK_WIDGET (info_bar->priv->label), TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON); info_bar->priv->progress_bar = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); gtk_widget_set_hexpand (GTK_WIDGET (info_bar->priv->progress_bar), TRUE); gtk_widget_show (GTK_WIDGET (info_bar->priv->progress_bar)); tepl_info_bar_add_content_widget (TEPL_INFO_BAR (info_bar), GTK_WIDGET (info_bar->priv->progress_bar), TEPL_INFO_BAR_LOCATION_BELOW_ICON); } /** * tepl_progress_info_bar_new: * @icon_name: (nullable): a value for the #TeplInfoBar:icon-name property, or * %NULL. * @markup: (nullable): if not %NULL, tepl_progress_info_bar_set_markup() is * called. * @has_cancel_button: a value for the #TeplProgressInfoBar:has-cancel-button * property. * * Returns: a new #TeplProgressInfoBar widget. * Since: 6.0 */ TeplProgressInfoBar * tepl_progress_info_bar_new (const gchar *icon_name, const gchar *markup, gboolean has_cancel_button) { TeplProgressInfoBar *info_bar; info_bar = g_object_new (TEPL_TYPE_PROGRESS_INFO_BAR, "icon-name", icon_name, "has-cancel-button", has_cancel_button, NULL); if (markup != NULL) { tepl_progress_info_bar_set_markup (info_bar, markup); } return info_bar; } /** * tepl_progress_info_bar_set_markup: * @info_bar: a #TeplProgressInfoBar. * @markup: markup text. * * Calls gtk_label_set_markup() on the #GtkLabel contained within the @info_bar. * * Since: 6.0 */ void tepl_progress_info_bar_set_markup (TeplProgressInfoBar *info_bar, const gchar *markup) { g_return_if_fail (TEPL_IS_PROGRESS_INFO_BAR (info_bar)); g_return_if_fail (markup != NULL); gtk_label_set_markup (info_bar->priv->label, markup); } /** * tepl_progress_info_bar_set_text: * @info_bar: a #TeplProgressInfoBar. * @text: text. * * Calls gtk_label_set_text() on the #GtkLabel contained within the @info_bar. * * Since: 6.0 */ void tepl_progress_info_bar_set_text (TeplProgressInfoBar *info_bar, const gchar *text) { g_return_if_fail (TEPL_IS_PROGRESS_INFO_BAR (info_bar)); g_return_if_fail (text != NULL); gtk_label_set_text (info_bar->priv->label, text); } /** * tepl_progress_info_bar_set_fraction: * @info_bar: a #TeplProgressInfoBar. * @fraction: fraction of the task that's been completed. * * Calls gtk_progress_bar_set_fraction() on the #GtkProgressBar contained within * the @info_bar. * * Since: 6.0 */ void tepl_progress_info_bar_set_fraction (TeplProgressInfoBar *info_bar, gdouble fraction) { g_return_if_fail (TEPL_IS_PROGRESS_INFO_BAR (info_bar)); gtk_progress_bar_set_fraction (info_bar->priv->progress_bar, fraction); } /** * tepl_progress_info_bar_pulse: * @info_bar: a #TeplProgressInfoBar. * * Calls gtk_progress_bar_pulse() on the #GtkProgressBar contained within the * @info_bar. * * Since: 6.0 */ void tepl_progress_info_bar_pulse (TeplProgressInfoBar *info_bar) { g_return_if_fail (TEPL_IS_PROGRESS_INFO_BAR (info_bar)); gtk_progress_bar_pulse (info_bar->priv->progress_bar); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-progress-info-bar.h000066400000000000000000000044051526404732400276350ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2005 - Paolo Maggi * SPDX-FileCopyrightText: 2016, 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_PROGRESS_INFO_BAR_H #define TEPL_PROGRESS_INFO_BAR_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS #define TEPL_TYPE_PROGRESS_INFO_BAR (tepl_progress_info_bar_get_type ()) #define TEPL_PROGRESS_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PROGRESS_INFO_BAR, TeplProgressInfoBar)) #define TEPL_PROGRESS_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PROGRESS_INFO_BAR, TeplProgressInfoBarClass)) #define TEPL_IS_PROGRESS_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PROGRESS_INFO_BAR)) #define TEPL_IS_PROGRESS_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PROGRESS_INFO_BAR)) #define TEPL_PROGRESS_INFO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PROGRESS_INFO_BAR, TeplProgressInfoBarClass)) typedef struct _TeplProgressInfoBar TeplProgressInfoBar; typedef struct _TeplProgressInfoBarClass TeplProgressInfoBarClass; typedef struct _TeplProgressInfoBarPrivate TeplProgressInfoBarPrivate; struct _TeplProgressInfoBar { TeplInfoBar parent; TeplProgressInfoBarPrivate *priv; }; struct _TeplProgressInfoBarClass { TeplInfoBarClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_progress_info_bar_get_type (void); G_MODULE_EXPORT TeplProgressInfoBar * tepl_progress_info_bar_new (const gchar *icon_name, const gchar *markup, gboolean has_cancel_button); G_MODULE_EXPORT void tepl_progress_info_bar_set_markup (TeplProgressInfoBar *info_bar, const gchar *markup); G_MODULE_EXPORT void tepl_progress_info_bar_set_text (TeplProgressInfoBar *info_bar, const gchar *text); G_MODULE_EXPORT void tepl_progress_info_bar_set_fraction (TeplProgressInfoBar *info_bar, gdouble fraction); G_MODULE_EXPORT void tepl_progress_info_bar_pulse (TeplProgressInfoBar *info_bar); G_END_DECLS #endif /* TEPL_PROGRESS_INFO_BAR_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-settings-binding-group.c000066400000000000000000000060661526404732400307000ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-settings-binding-group.h" #include /** * SECTION:settings-binding-group * @Title: TeplSettingsBindingGroup * @Short_description: A group of #GSettings bindings * * #TeplSettingsBindingGroup is a small utility to call g_settings_unbind() on a * group of properties (on the same #GObject). * * The documentation of g_settings_unbind() says that bindings are automatically * removed when the object is finalized. The purpose of * #TeplSettingsBindingGroup is to unbind the settings in `dispose()` instead. * Setting a property while an object has already been disposed but not * finalized is usually not well tested, and can result to crashes, so it is * more robust to unbind the settings in `dispose()`. * * To achieve the same, you can also write a list of g_settings_unbind() calls * at the appropriate place. But where g_settings_bind() (or similar) and * g_settings_unbind() need to be called are at different places so it is more * error-prone to maintain. With this utility, tepl_settings_binding_group_add() * is called at the same place as g_settings_bind(). */ struct _TeplSettingsBindingGroup { GSList *property_names; }; /** * tepl_settings_binding_group_new: (skip) * * Returns: (transfer full): a new #TeplSettingsBindingGroup instance. * Since: 6.11 */ TeplSettingsBindingGroup * tepl_settings_binding_group_new (void) { return g_new0 (TeplSettingsBindingGroup, 1); } /** * tepl_settings_binding_group_free: (skip) * @group: (nullable): a #TeplSettingsBindingGroup. * * Frees a #TeplSettingsBindingGroup instance. * * Since: 6.11 */ void tepl_settings_binding_group_free (TeplSettingsBindingGroup *group) { if (group != NULL) { g_slist_free_full (group->property_names, g_free); g_free (group); } } /** * tepl_settings_binding_group_add: * @group: a #TeplSettingsBindingGroup. * @property_name: the name of a #GObject property. * * Adds @property_name to @group. * * Each time that you call g_settings_bind() (or similar), you should call this * function too. * * Since: 6.11 */ void tepl_settings_binding_group_add (TeplSettingsBindingGroup *group, const gchar *property_name) { g_return_if_fail (group != NULL); g_return_if_fail (property_name != NULL); group->property_names = g_slist_prepend (group->property_names, g_strdup (property_name)); } /** * tepl_settings_binding_group_unbind: * @group: a #TeplSettingsBindingGroup. * @object: a #GObject. * * Calls g_settings_unbind() on @object for all properties that have been added * to @group. * * This function is intended to be called in `dispose()`. * * Since: 6.11 */ void tepl_settings_binding_group_unbind (TeplSettingsBindingGroup *group, GObject *object) { GSList *l; g_return_if_fail (group != NULL); g_return_if_fail (G_IS_OBJECT (object)); for (l = group->property_names; l != NULL; l = l->next) { const gchar *property_name = l->data; g_settings_unbind (object, property_name); } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-settings-binding-group.h000066400000000000000000000016651526404732400307050ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_SETTINGS_BINDING_GROUP_H #define TEPL_SETTINGS_BINDING_GROUP_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS typedef struct _TeplSettingsBindingGroup TeplSettingsBindingGroup; G_MODULE_EXPORT TeplSettingsBindingGroup * tepl_settings_binding_group_new (void); G_MODULE_EXPORT void tepl_settings_binding_group_free (TeplSettingsBindingGroup *group); G_MODULE_EXPORT void tepl_settings_binding_group_add (TeplSettingsBindingGroup *group, const gchar *property_name); G_MODULE_EXPORT void tepl_settings_binding_group_unbind (TeplSettingsBindingGroup *group, GObject *object); G_END_DECLS #endif /* TEPL_SETTINGS_BINDING_GROUP_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-settings.c000066400000000000000000000523061526404732400261340ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-settings.h" #include /** * SECTION:settings * @title: TeplSettings * @short_description: Singleton class containing #GSettings objects * * #TeplSettings is a singleton class to have a central access to some * #GSettings objects and having convenience features that are useful for a text * editor. * * The central access permits to: * - Share the same #GSettings objects between different parts of the * application. * - Avoid the need to store #GSettings objects a bit everywhere in different * classes. */ #define KEY_SYSTEM_FONT "monospace-font-name" #define KEY_SYSTEM_COLOR_SCHEME "color-scheme" struct _TeplSettingsPrivate { GSettings *settings_desktop_interface; /* Invariant: the following 3 instance variables are either all NULL or * all set. */ GSettings *settings_font; gchar *key_use_default_font; gchar *key_editor_font; /* Invariant: the following 2 instance variables are either all NULL or * all set. */ GSettings *settings_theme_variant; gchar *key_theme_variant; /* Invariant: the following 3 instance variables are either all NULL or * all set. */ GSettings *settings_style_scheme; gchar *key_style_scheme_id_for_light_theme; gchar *key_style_scheme_id_for_dark_theme; guint handle_theme_variant : 1; }; enum { SIGNAL_FONT_CHANGED, N_SIGNALS }; enum { PROP_0, PROP_STYLE_SCHEME_ID, N_PROPERTIES }; static guint signals[N_SIGNALS]; static GParamSpec *properties[N_PROPERTIES]; /* TeplSettings is a singleton. */ static TeplSettings *singleton = NULL; G_DEFINE_TYPE_WITH_PRIVATE (TeplSettings, tepl_settings, G_TYPE_OBJECT) static void tepl_settings_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplSettings *settings = TEPL_SETTINGS (object); switch (prop_id) { case PROP_STYLE_SCHEME_ID: g_value_take_string (value, tepl_settings_get_style_scheme_id (settings)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_settings_dispose (GObject *object) { TeplSettings *self = TEPL_SETTINGS (object); g_clear_object (&self->priv->settings_desktop_interface); g_clear_object (&self->priv->settings_font); g_clear_pointer (&self->priv->key_use_default_font, g_free); g_clear_pointer (&self->priv->key_editor_font, g_free); g_clear_object (&self->priv->settings_theme_variant); g_clear_pointer (&self->priv->key_theme_variant, g_free); g_clear_object (&self->priv->settings_style_scheme); g_clear_pointer (&self->priv->key_style_scheme_id_for_light_theme, g_free); g_clear_pointer (&self->priv->key_style_scheme_id_for_dark_theme, g_free); G_OBJECT_CLASS (tepl_settings_parent_class)->dispose (object); } static void tepl_settings_finalize (GObject *object) { if (singleton == TEPL_SETTINGS (object)) { singleton = NULL; } G_OBJECT_CLASS (tepl_settings_parent_class)->finalize (object); } static void tepl_settings_class_init (TeplSettingsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_settings_get_property; object_class->dispose = tepl_settings_dispose; object_class->finalize = tepl_settings_finalize; /** * TeplSettings::font-changed: * @settings: the #TeplSettings emitting the signal. * * The ::font-changed signal is emitted when the return value of * tepl_settings_get_selected_font() has potentially changed. * * It takes into account the @use_default_font_key provided with * tepl_settings_provide_font_settings() to avoid unnecessary signal * emission. In other words, for example if @use_default_font_key is * %FALSE, the signal is not emitted even if the default (system's) font * has been modified. * * The relation between this signal and a potential zoom in and zoom out * feature, to temporarily make the font larger or smaller (so the zoom * level not being stored in #GSettings): when this signal is emitted, * it means that the user has explicitly changed the font setting, and * as such he or she probably wants to use that font instead. So the * expected behavior in that case is to reset the zoom level. But it's * left as an exercise for another class, since #TeplSettings is only * for #GSettings. * * Since: 6.2 */ signals[SIGNAL_FONT_CHANGED] = g_signal_new ("font-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0); /** * TeplSettings:style-scheme-id: * * See tepl_settings_provide_style_scheme_settings(). * * The value of this property depends on whether the GTK theme is light * or dark, and uses the corresponding #GSettings key. * * Since: 6.11 */ properties[PROP_STYLE_SCHEME_ID] = g_param_spec_string ("style-scheme-id", "style-scheme-id", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static gboolean use_default_font (TeplSettings *self) { if (self->priv->settings_font == NULL) { return TRUE; } return g_settings_get_boolean (self->priv->settings_font, self->priv->key_use_default_font); } static void system_font_changed_cb (GSettings *settings_desktop_interface, gchar *key, gpointer user_data) { TeplSettings *self = TEPL_SETTINGS (user_data); if (use_default_font (self)) { g_signal_emit (self, signals[SIGNAL_FONT_CHANGED], 0); } } static void use_default_font_changed_cb (GSettings *settings_font, gchar *key, gpointer user_data) { TeplSettings *self = TEPL_SETTINGS (user_data); g_signal_emit (self, signals[SIGNAL_FONT_CHANGED], 0); } static void editor_font_changed_cb (GSettings *settings_font, gchar *key, gpointer user_data) { TeplSettings *self = TEPL_SETTINGS (user_data); if (!use_default_font (self)) { g_signal_emit (self, signals[SIGNAL_FONT_CHANGED], 0); } } static void tepl_settings_init (TeplSettings *self) { self->priv = tepl_settings_get_instance_private (self); self->priv->settings_desktop_interface = g_settings_new ("org.gnome.desktop.interface"); g_signal_connect_object (self->priv->settings_desktop_interface, "changed::" KEY_SYSTEM_FONT, G_CALLBACK (system_font_changed_cb), self, 0); } /** * tepl_settings_get_singleton: * * Returns: (transfer none): the #TeplSettings singleton instance. * Since: 6.2 */ TeplSettings * tepl_settings_get_singleton (void) { if (singleton == NULL) { singleton = g_object_new (TEPL_TYPE_SETTINGS, NULL); } return singleton; } void _tepl_settings_unref_singleton (void) { if (singleton != NULL) { g_object_unref (singleton); } /* singleton is not set to NULL here, it is set to NULL in * tepl_settings_finalize() (i.e. when we are sure that the ref count * reaches 0). */ } /** * tepl_settings_peek_desktop_interface_settings: * @self: the #TeplSettings instance. * * Returns: (transfer none): the #GSettings for `"org.gnome.desktop.interface"`. * Since: 6.2 */ GSettings * tepl_settings_peek_desktop_interface_settings (TeplSettings *self) { g_return_val_if_fail (TEPL_IS_SETTINGS (self), NULL); return self->priv->settings_desktop_interface; } /** * tepl_settings_provide_font_settings: * @self: the #TeplSettings instance. * @font_settings: the #GSettings object containing the keys. * @use_default_font_key: a key of type boolean. * @editor_font_key: a key of type string. * * This function can only be called once, to provide two keys: * - @use_default_font_key: must be of type boolean, to know whether to use the * system's font (the default font), or the editor font. * - @editor_font_key: must be of type string, containing the font name to have * a different font for the text editor, rather than using the system's font. * * See tepl_settings_get_selected_font(). * * Since: 6.2 */ void tepl_settings_provide_font_settings (TeplSettings *self, GSettings *font_settings, const gchar *use_default_font_key, const gchar *editor_font_key) { gchar *detailed_signal = NULL; g_return_if_fail (TEPL_IS_SETTINGS (self)); g_return_if_fail (G_IS_SETTINGS (font_settings)); g_return_if_fail (use_default_font_key != NULL); g_return_if_fail (editor_font_key != NULL); g_return_if_fail (self->priv->settings_font == NULL); g_return_if_fail (self->priv->key_use_default_font == NULL); g_return_if_fail (self->priv->key_editor_font == NULL); self->priv->settings_font = g_object_ref (font_settings); self->priv->key_use_default_font = g_strdup (use_default_font_key); self->priv->key_editor_font = g_strdup (editor_font_key); detailed_signal = g_strconcat ("changed::", use_default_font_key, NULL); g_signal_connect_object (font_settings, detailed_signal, G_CALLBACK (use_default_font_changed_cb), self, 0); g_free (detailed_signal); detailed_signal = g_strconcat ("changed::", editor_font_key, NULL); g_signal_connect_object (font_settings, detailed_signal, G_CALLBACK (editor_font_changed_cb), self, 0); g_free (detailed_signal); if (!use_default_font (self)) { g_signal_emit (self, signals[SIGNAL_FONT_CHANGED], 0); } } /** * tepl_settings_get_selected_font: * @self: the #TeplSettings instance. * * If tepl_settings_provide_font_settings() has *not* been called, this function * always returns the current value of the system's fixed width (monospace) * font. * * If tepl_settings_provide_font_settings() *has* been called, this function * returns the font name depending on the boolean value of * @use_default_font_key. * * See also the #TeplSettings::font-changed signal, * tepl_utils_override_font_string() and tepl_prefs_create_font_component(). * * Returns: the selected font name. * Since: 6.2 */ gchar * tepl_settings_get_selected_font (TeplSettings *self) { g_return_val_if_fail (TEPL_IS_SETTINGS (self), NULL); if (use_default_font (self)) { return g_settings_get_string (self->priv->settings_desktop_interface, KEY_SYSTEM_FONT); } return g_settings_get_string (self->priv->settings_font, self->priv->key_editor_font); } static void update_theme_variant (TeplSettings *self) { HdyStyleManager *style_manager = hdy_style_manager_get_default (); /* For a text editor, prefer a light theme. See the documentation of the * GtkSettings:gtk-application-prefer-dark-theme property: * * "Dark themes should not be used for documents, where large spaces are * white/light and the dark chrome creates too much contrast (web * browser, text editor...)." */ HdyColorScheme color_scheme = HDY_COLOR_SCHEME_PREFER_LIGHT; if (self->priv->settings_theme_variant != NULL) { TeplSettingsThemeVariant variant; variant = g_settings_get_enum (self->priv->settings_theme_variant, self->priv->key_theme_variant); switch (variant) { case TEPL_SETTINGS_THEME_VARIANT_SYSTEM: if (!hdy_style_manager_get_system_supports_color_schemes (style_manager)) { /* Do as if the 'system' enum value didn't exist, * with 'light' as the default. */ color_scheme = HDY_COLOR_SCHEME_FORCE_LIGHT; } break; case TEPL_SETTINGS_THEME_VARIANT_LIGHT: color_scheme = HDY_COLOR_SCHEME_FORCE_LIGHT; break; case TEPL_SETTINGS_THEME_VARIANT_DARK: color_scheme = HDY_COLOR_SCHEME_FORCE_DARK; break; default: g_return_if_reached (); } } hdy_style_manager_set_color_scheme (style_manager, color_scheme); } static void theme_variant_changed_cb (GSettings *settings, const gchar *key, TeplSettings *self) { update_theme_variant (self); } /** * tepl_settings_handle_theme_variant: * @self: the #TeplSettings instance. * @theme_variant_settings: (nullable): a #GSettings object, or %NULL. * @theme_variant_setting_key: (nullable): a #GSettings key of type enum * #TeplSettingsThemeVariant, or %NULL. * * This function permits to setup correctly the GTK theme variant to use. * * If @theme_variant_settings and @theme_variant_setting_key are %NULL, only the * system's settings will be taken into account. * * If @theme_variant_settings and @theme_variant_setting_key are provided, they * are taken into account according to #TeplSettingsThemeVariant. * * You should call this function only once, as subsequent calls are ignored (the * setting used cannot be reconfigured). * * Since: 6.10 */ void tepl_settings_handle_theme_variant (TeplSettings *self, GSettings *theme_variant_settings, const gchar *theme_variant_setting_key) { g_return_if_fail (TEPL_IS_SETTINGS (self)); g_return_if_fail (theme_variant_settings == NULL || G_IS_SETTINGS (theme_variant_settings)); if (self->priv->handle_theme_variant) { /* Already done. Cannot be re-configured. */ return; } g_return_if_fail (self->priv->settings_theme_variant == NULL); g_return_if_fail (self->priv->key_theme_variant == NULL); hdy_init (); if (theme_variant_settings != NULL && theme_variant_setting_key != NULL) { gchar *detailed_signal; self->priv->settings_theme_variant = g_object_ref (theme_variant_settings); self->priv->key_theme_variant = g_strdup (theme_variant_setting_key); detailed_signal = g_strconcat ("changed::", theme_variant_setting_key, NULL); g_signal_connect_object (theme_variant_settings, detailed_signal, G_CALLBACK (theme_variant_changed_cb), self, G_CONNECT_DEFAULT); g_free (detailed_signal); } update_theme_variant (self); self->priv->handle_theme_variant = TRUE; } static void style_scheme_setting_changed_cb (GSettings *style_scheme_settings, const gchar *key, TeplSettings *self) { g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STYLE_SCHEME_ID]); } static void style_manager_dark_notify_cb (HdyStyleManager *style_manager, GParamSpec *pspec, TeplSettings *self) { g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STYLE_SCHEME_ID]); } /** * tepl_settings_provide_style_scheme_settings: * @self: the #TeplSettings instance. * @style_scheme_settings: the #GSettings object containing the keys. * @key_for_light_theme_variant: a key of type string. * @key_for_dark_theme_variant: a key of type string. * * This function can only be called once, to provide two keys: * - @key_for_light_theme_variant: must be of type string, containing the ID of * a #GtkSourceStyleScheme that should be used when the GTK theme variant is * light. * - @key_for_dark_theme_variant: the same, but when the GTK theme variant is * dark. * * See tepl_settings_get_style_scheme_id(). * * Since: 6.11 */ void tepl_settings_provide_style_scheme_settings (TeplSettings *self, GSettings *style_scheme_settings, const gchar *key_for_light_theme_variant, const gchar *key_for_dark_theme_variant) { gchar *detailed_signal; HdyStyleManager *style_manager; g_return_if_fail (TEPL_IS_SETTINGS (self)); g_return_if_fail (G_IS_SETTINGS (style_scheme_settings)); g_return_if_fail (key_for_light_theme_variant != NULL); g_return_if_fail (key_for_dark_theme_variant != NULL); g_return_if_fail (self->priv->settings_style_scheme == NULL); g_return_if_fail (self->priv->key_style_scheme_id_for_light_theme == NULL); g_return_if_fail (self->priv->key_style_scheme_id_for_dark_theme == NULL); self->priv->settings_style_scheme = g_object_ref (style_scheme_settings); self->priv->key_style_scheme_id_for_light_theme = g_strdup (key_for_light_theme_variant); self->priv->key_style_scheme_id_for_dark_theme = g_strdup (key_for_dark_theme_variant); detailed_signal = g_strconcat ("changed::", key_for_light_theme_variant, NULL); g_signal_connect_object (style_scheme_settings, detailed_signal, G_CALLBACK (style_scheme_setting_changed_cb), self, G_CONNECT_DEFAULT); g_free (detailed_signal); detailed_signal = g_strconcat ("changed::", key_for_dark_theme_variant, NULL); g_signal_connect_object (style_scheme_settings, detailed_signal, G_CALLBACK (style_scheme_setting_changed_cb), self, G_CONNECT_DEFAULT); g_free (detailed_signal); style_manager = hdy_style_manager_get_default (); g_signal_connect_object (style_manager, "notify::dark", G_CALLBACK (style_manager_dark_notify_cb), self, G_CONNECT_DEFAULT); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STYLE_SCHEME_ID]); } /** * tepl_settings_get_style_scheme_id: * @self: the #TeplSettings instance. * * Returns: (transfer full) (nullable): the value of the * #TeplSettings:style-scheme-id property. * Since: 6.11 */ gchar * tepl_settings_get_style_scheme_id (TeplSettings *self) { HdyStyleManager *style_manager; g_return_val_if_fail (TEPL_IS_SETTINGS (self), NULL); if (self->priv->settings_style_scheme == NULL) { return NULL; } style_manager = hdy_style_manager_get_default (); if (hdy_style_manager_get_dark (style_manager)) { return g_settings_get_string (self->priv->settings_style_scheme, self->priv->key_style_scheme_id_for_dark_theme); } return g_settings_get_string (self->priv->settings_style_scheme, self->priv->key_style_scheme_id_for_light_theme); } gchar * _tepl_settings_get_default_style_scheme_id (TeplSettings *self) { g_return_val_if_fail (TEPL_IS_SETTINGS (self), NULL); if (self->priv->settings_style_scheme != NULL) { HdyStyleManager *style_manager = hdy_style_manager_get_default (); const gchar *key_style_scheme_id; GVariant *default_value; gchar *default_style_scheme_id = NULL; if (hdy_style_manager_get_dark (style_manager)) { key_style_scheme_id = self->priv->key_style_scheme_id_for_dark_theme; } else { key_style_scheme_id = self->priv->key_style_scheme_id_for_light_theme; } default_value = g_settings_get_default_value (self->priv->settings_style_scheme, key_style_scheme_id); if (default_value != NULL) { default_style_scheme_id = g_variant_dup_string (default_value, NULL); g_variant_unref (default_value); } if (default_style_scheme_id != NULL) { return default_style_scheme_id; } } return g_strdup ("tango"); } GSettings * _tepl_settings_get_style_scheme_settings (TeplSettings *self, const gchar **key_for_light_theme_variant, const gchar **key_for_dark_theme_variant) { g_return_val_if_fail (TEPL_IS_SETTINGS (self), NULL); if (key_for_light_theme_variant != NULL) { *key_for_light_theme_variant = self->priv->key_style_scheme_id_for_light_theme; } if (key_for_dark_theme_variant != NULL) { *key_for_dark_theme_variant = self->priv->key_style_scheme_id_for_dark_theme; } return self->priv->settings_style_scheme; } /** * tepl_settings_get_range_uint: * @settings: a #GSettings. * @key: a key part of @settings. * @min: (out): the minimum value allowed by the range. * @max: (out): the maximum value allowed by the range. * * This function introspects a #GSettings key to get its range, if the key as a * "u" type (unsigned integer). %FALSE is returned if the introspection failed. * * See g_settings_schema_key_get_range() for more flexibility. * * Returns: whether the operation was successful. * Since: 6.2 */ gboolean tepl_settings_get_range_uint (GSettings *settings, const gchar *key, guint32 *min, guint32 *max) { GSettingsSchema *schema = NULL; GSettingsSchemaKey *schema_key = NULL; GVariant *range = NULL; gchar *range_type = NULL; GVariant *range_values = NULL; const gchar *range_values_format; gboolean success = FALSE; g_return_val_if_fail (G_IS_SETTINGS (settings), FALSE); g_return_val_if_fail (key != NULL, FALSE); g_return_val_if_fail (min != NULL, FALSE); g_return_val_if_fail (max != NULL, FALSE); *min = 0; *max = 0; g_object_get (settings, "settings-schema", &schema, NULL); g_return_val_if_fail (schema != NULL, FALSE); if (!g_settings_schema_has_key (schema, key)) { goto out; } schema_key = g_settings_schema_get_key (schema, key); range = g_settings_schema_key_get_range (schema_key); g_variant_get (range, "(sv)", &range_type, &range_values); if (g_strcmp0 (range_type, "range") != 0) { goto out; } range_values_format = g_variant_get_type_string (range_values); if (g_strcmp0 (range_values_format, "(uu)") != 0) { goto out; } g_variant_get (range_values, "(uu)", min, max); success = TRUE; out: g_clear_pointer (&schema, g_settings_schema_unref); g_clear_pointer (&schema_key, g_settings_schema_key_unref); g_clear_pointer (&range, g_variant_unref); g_free (range_type); g_clear_pointer (&range_values, g_variant_unref); return success; } /** * tepl_settings_reset_all: * @schema_id: a #GSettings schema id. * * Resets all the #GSettings keys belonging to @schema_id. * * Since: 6.13 */ void tepl_settings_reset_all (const gchar *schema_id) { GSettings *settings; GSettingsSchema *schema = NULL; gchar **keys = NULL; g_return_if_fail (schema_id != NULL); settings = g_settings_new (schema_id); g_object_get (settings, "settings-schema", &schema, NULL); if (schema != NULL) { keys = g_settings_schema_list_keys (schema); } if (keys != NULL) { gint i; for (i = 0; keys[i] != NULL; i++) { g_settings_reset (settings, keys[i]); } } g_object_unref (settings); g_clear_pointer (&schema, g_settings_schema_unref); g_strfreev (keys); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-settings.h000066400000000000000000000064771526404732400261510ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_SETTINGS_H #define TEPL_SETTINGS_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_SETTINGS (tepl_settings_get_type ()) #define TEPL_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_SETTINGS, TeplSettings)) #define TEPL_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_SETTINGS, TeplSettingsClass)) #define TEPL_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_SETTINGS)) #define TEPL_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_SETTINGS)) #define TEPL_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_SETTINGS, TeplSettingsClass)) typedef struct _TeplSettings TeplSettings; typedef struct _TeplSettingsClass TeplSettingsClass; typedef struct _TeplSettingsPrivate TeplSettingsPrivate; struct _TeplSettings { GObject parent; TeplSettingsPrivate *priv; }; struct _TeplSettingsClass { GObjectClass parent_class; gpointer padding[12]; }; /** * TeplSettingsThemeVariant: * @TEPL_SETTINGS_THEME_VARIANT_SYSTEM: Follow the system's preference. * @TEPL_SETTINGS_THEME_VARIANT_LIGHT: Force a light theme. * @TEPL_SETTINGS_THEME_VARIANT_DARK: Force a dark theme. * * This enum is intended to be used for controlling the GTK theme preference. * * Since: 6.10 */ typedef enum { TEPL_SETTINGS_THEME_VARIANT_SYSTEM = 0, TEPL_SETTINGS_THEME_VARIANT_LIGHT = 1, TEPL_SETTINGS_THEME_VARIANT_DARK = 2, } TeplSettingsThemeVariant; G_MODULE_EXPORT GType tepl_settings_get_type (void); G_MODULE_EXPORT TeplSettings * tepl_settings_get_singleton (void); G_GNUC_INTERNAL void _tepl_settings_unref_singleton (void); G_MODULE_EXPORT GSettings * tepl_settings_peek_desktop_interface_settings (TeplSettings *self); G_MODULE_EXPORT void tepl_settings_provide_font_settings (TeplSettings *self, GSettings *font_settings, const gchar *use_default_font_key, const gchar *editor_font_key); G_MODULE_EXPORT gchar * tepl_settings_get_selected_font (TeplSettings *self); G_MODULE_EXPORT void tepl_settings_handle_theme_variant (TeplSettings *self, GSettings *theme_variant_settings, const gchar *theme_variant_setting_key); G_MODULE_EXPORT void tepl_settings_provide_style_scheme_settings (TeplSettings *self, GSettings *style_scheme_settings, const gchar *key_for_light_theme_variant, const gchar *key_for_dark_theme_variant); G_MODULE_EXPORT gchar * tepl_settings_get_style_scheme_id (TeplSettings *self); G_GNUC_INTERNAL gchar * _tepl_settings_get_default_style_scheme_id (TeplSettings *self); G_GNUC_INTERNAL GSettings * _tepl_settings_get_style_scheme_settings (TeplSettings *self, const gchar **key_for_light_theme_variant, const gchar **key_for_dark_theme_variant); G_MODULE_EXPORT gboolean tepl_settings_get_range_uint (GSettings *settings, const gchar *key, guint32 *min, guint32 *max); G_MODULE_EXPORT void tepl_settings_reset_all (const gchar *schema_id); G_END_DECLS #endif /* TEPL_SETTINGS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-signal-group.c000066400000000000000000000060511526404732400266770ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-signal-group.h" /** * SECTION:signal-group * @Title: TeplSignalGroup * @Short_description: A group of signal handlers * * #TeplSignalGroup is a small utility to disconnect signal handlers without the * need to keep around the #GObject instance that the signal handlers were * connected to. */ /* It was inspired by DzlSignalGroup from libdazzle. TeplSignalGroup has a much * simpler implementation, it applies the "worse is better" philosophy. */ struct _TeplSignalGroup { /* The GObject that the signal handlers are connected to. * Weak ref. */ GObject *object; /* The IDs of the signal handlers. Element-type: gulong. */ GArray *handler_ids; }; /** * tepl_signal_group_new: (skip) * @object: a #GObject. * * Creates a new #TeplSignalGroup for @object. The #TeplSignalGroup will have a * weak reference to @object. * * Returns: (transfer full): a new #TeplSignalGroup for @object. Free with * tepl_signal_group_clear() when no longer needed. * Since: 6.0 */ TeplSignalGroup * tepl_signal_group_new (GObject *object) { TeplSignalGroup *group; g_return_val_if_fail (G_IS_OBJECT (object), NULL); group = g_new0 (TeplSignalGroup, 1); g_set_weak_pointer (&group->object, object); group->handler_ids = g_array_new (FALSE, TRUE, sizeof (gulong)); return group; } static void signal_group_free (TeplSignalGroup *group) { if (group == NULL) { return; } if (group->object != NULL) { guint i; /* Disconnect all signal handlers. */ for (i = 0; i < group->handler_ids->len; i++) { gulong handler_id; handler_id = g_array_index (group->handler_ids, gulong, i); g_signal_handler_disconnect (group->object, handler_id); } g_clear_weak_pointer (&group->object); } g_array_free (group->handler_ids, TRUE); g_free (group); } /** * tepl_signal_group_clear: (skip) * @group_pointer: a pointer to a #TeplSignalGroup. * * Like g_clear_object() but for a #TeplSignalGroup. * * If the #GObject instance of the #TeplSignalGroup is still alive, this * function disconnects all the signal handlers that were added with * tepl_signal_group_add(). * * The #TeplSignalGroup, if non-%NULL, is freed when calling this function. * * Since: 6.0 */ void tepl_signal_group_clear (TeplSignalGroup **group_pointer) { g_return_if_fail (group_pointer != NULL); signal_group_free (*group_pointer); *group_pointer = NULL; } /** * tepl_signal_group_add: (skip) * @group: a #TeplSignalGroup. * @signal_handler_id: a signal handler ID. * * Adds a signal handler ID to the #TeplSignalGroup. The signal handler must * have been connected to the same #GObject instance as provided to the * tepl_signal_group_new() function when creating @group. * * Since: 6.0 */ void tepl_signal_group_add (TeplSignalGroup *group, gulong signal_handler_id) { g_return_if_fail (group != NULL); g_return_if_fail (signal_handler_id != 0); g_array_append_val (group->handler_ids, signal_handler_id); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-signal-group.h000066400000000000000000000013471526404732400267070ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_SIGNAL_GROUP_H #define TEPL_SIGNAL_GROUP_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS typedef struct _TeplSignalGroup TeplSignalGroup; G_MODULE_EXPORT TeplSignalGroup * tepl_signal_group_new (GObject *object); G_MODULE_EXPORT void tepl_signal_group_clear (TeplSignalGroup **group_pointer); G_MODULE_EXPORT void tepl_signal_group_add (TeplSignalGroup *group, gulong signal_handler_id); G_END_DECLS #endif /* TEPL_SIGNAL_GROUP_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-space-drawer-prefs.c000066400000000000000000000325511526404732400277660ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-space-drawer-prefs.h" #include #include "tepl-utils.h" /** * SECTION:space-drawer-prefs * @Short_description: Preferences widget for #GtkSourceSpaceDrawer * @Title: TeplSpaceDrawerPrefs * * #TeplSpaceDrawerPrefs is a #GtkWidget for configuring the preferences about * white space drawing with #GtkSourceSpaceDrawer. * * The configuration is stored in the #GtkSourceSpaceDrawer:matrix property of * the associated #GtkSourceSpaceDrawer object. */ struct _TeplSpaceDrawerPrefsPrivate { /* Owned */ GtkSourceSpaceDrawer *space_drawer; /* First column */ GtkCheckButton *check_button_leading_tabs; GtkCheckButton *check_button_leading_spaces; GtkCheckButton *check_button_inside_text_tabs; GtkCheckButton *check_button_inside_text_spaces; GtkCheckButton *check_button_trailing_tabs; GtkCheckButton *check_button_trailing_spaces; GtkCheckButton *check_button_newlines; /* Second column */ GtkGrid *second_column_vgrid; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplSpaceDrawerPrefs, tepl_space_drawer_prefs, GTK_TYPE_GRID) static void matrix_notify_cb (GtkSourceSpaceDrawer *space_drawer, GParamSpec *pspec, TeplSpaceDrawerPrefs *prefs); static void tepl_space_drawer_prefs_dispose (GObject *object) { TeplSpaceDrawerPrefs *prefs = TEPL_SPACE_DRAWER_PREFS (object); g_clear_object (&prefs->priv->space_drawer); G_OBJECT_CLASS (tepl_space_drawer_prefs_parent_class)->dispose (object); } static void tepl_space_drawer_prefs_class_init (TeplSpaceDrawerPrefsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_space_drawer_prefs_dispose; } static void set_matrix_state_according_to_check_buttons (TeplSpaceDrawerPrefs *prefs) { GtkSourceSpaceTypeFlags space_types; g_signal_handlers_block_by_func (prefs->priv->space_drawer, matrix_notify_cb, prefs); space_types = GTK_SOURCE_SPACE_TYPE_NBSP; if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->priv->check_button_leading_tabs))) { space_types |= GTK_SOURCE_SPACE_TYPE_TAB; } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->priv->check_button_leading_spaces))) { space_types |= GTK_SOURCE_SPACE_TYPE_SPACE; } gtk_source_space_drawer_set_types_for_locations (prefs->priv->space_drawer, GTK_SOURCE_SPACE_LOCATION_LEADING, space_types); space_types = GTK_SOURCE_SPACE_TYPE_NBSP; if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->priv->check_button_inside_text_tabs))) { space_types |= GTK_SOURCE_SPACE_TYPE_TAB; } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->priv->check_button_inside_text_spaces))) { space_types |= GTK_SOURCE_SPACE_TYPE_SPACE; } gtk_source_space_drawer_set_types_for_locations (prefs->priv->space_drawer, GTK_SOURCE_SPACE_LOCATION_INSIDE_TEXT, space_types); space_types = GTK_SOURCE_SPACE_TYPE_NBSP; if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->priv->check_button_trailing_tabs))) { space_types |= GTK_SOURCE_SPACE_TYPE_TAB; } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->priv->check_button_trailing_spaces))) { space_types |= GTK_SOURCE_SPACE_TYPE_SPACE; } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->priv->check_button_newlines))) { space_types |= GTK_SOURCE_SPACE_TYPE_NEWLINE; } gtk_source_space_drawer_set_types_for_locations (prefs->priv->space_drawer, GTK_SOURCE_SPACE_LOCATION_TRAILING, space_types); g_signal_handlers_unblock_by_func (prefs->priv->space_drawer, matrix_notify_cb, prefs); } static void check_button_toggled_cb (GtkCheckButton *check_button, TeplSpaceDrawerPrefs *prefs) { set_matrix_state_according_to_check_buttons (prefs); } static void set_check_button_state (TeplSpaceDrawerPrefs *prefs, GtkCheckButton *check_button, gboolean is_active) { g_signal_handlers_block_by_func (check_button, check_button_toggled_cb, prefs); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), is_active); g_signal_handlers_unblock_by_func (check_button, check_button_toggled_cb, prefs); } static void set_check_buttons_state_according_to_matrix (TeplSpaceDrawerPrefs *prefs) { GtkSourceSpaceTypeFlags space_types; space_types = gtk_source_space_drawer_get_types_for_locations (prefs->priv->space_drawer, GTK_SOURCE_SPACE_LOCATION_LEADING); set_check_button_state (prefs, prefs->priv->check_button_leading_tabs, space_types & GTK_SOURCE_SPACE_TYPE_TAB); set_check_button_state (prefs, prefs->priv->check_button_leading_spaces, space_types & GTK_SOURCE_SPACE_TYPE_SPACE); space_types = gtk_source_space_drawer_get_types_for_locations (prefs->priv->space_drawer, GTK_SOURCE_SPACE_LOCATION_INSIDE_TEXT); set_check_button_state (prefs, prefs->priv->check_button_inside_text_tabs, space_types & GTK_SOURCE_SPACE_TYPE_TAB); set_check_button_state (prefs, prefs->priv->check_button_inside_text_spaces, space_types & GTK_SOURCE_SPACE_TYPE_SPACE); space_types = gtk_source_space_drawer_get_types_for_locations (prefs->priv->space_drawer, GTK_SOURCE_SPACE_LOCATION_TRAILING); set_check_button_state (prefs, prefs->priv->check_button_trailing_tabs, space_types & GTK_SOURCE_SPACE_TYPE_TAB); set_check_button_state (prefs, prefs->priv->check_button_trailing_spaces, space_types & GTK_SOURCE_SPACE_TYPE_SPACE); set_check_button_state (prefs, prefs->priv->check_button_newlines, space_types & GTK_SOURCE_SPACE_TYPE_NEWLINE); } static GtkCheckButton * create_check_button (TeplSpaceDrawerPrefs *prefs, const gchar *label) { GtkCheckButton *check_button; check_button = GTK_CHECK_BUTTON (gtk_check_button_new_with_label (label)); gtk_widget_set_margin_start (GTK_WIDGET (check_button), 12); g_signal_connect (check_button, "toggled", G_CALLBACK (check_button_toggled_cb), prefs); return check_button; } static void init_check_buttons (TeplSpaceDrawerPrefs *prefs) { prefs->priv->check_button_leading_tabs = create_check_button (prefs, _("Draw tabs")); prefs->priv->check_button_leading_spaces = create_check_button (prefs, _("Draw spaces")); prefs->priv->check_button_inside_text_tabs = create_check_button (prefs, _("Draw tabs")); prefs->priv->check_button_inside_text_spaces = create_check_button (prefs, _("Draw spaces")); prefs->priv->check_button_trailing_tabs = create_check_button (prefs, _("Draw tabs")); prefs->priv->check_button_trailing_spaces = create_check_button (prefs, _("Draw spaces")); prefs->priv->check_button_newlines = create_check_button (prefs, _("Draw new lines")); set_check_buttons_state_according_to_matrix (prefs); } static GtkWidget * create_subtitle_label (const gchar *str) { gchar *str_escaped; gchar *str_in_bold; GtkWidget *label; str_escaped = tepl_utils_markup_escape_text (str); str_in_bold = g_strdup_printf ("%s", str_escaped); label = gtk_label_new (str_in_bold); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_widget_set_halign (label, GTK_ALIGN_START); g_free (str_escaped); g_free (str_in_bold); return label; } static void add_check_buttons (TeplSpaceDrawerPrefs *prefs) { GtkContainer *vgrid; init_check_buttons (prefs); vgrid = GTK_CONTAINER (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 6); gtk_container_add (vgrid, create_subtitle_label (_("Leading Spaces"))); gtk_container_add (vgrid, GTK_WIDGET (prefs->priv->check_button_leading_tabs)); gtk_container_add (vgrid, GTK_WIDGET (prefs->priv->check_button_leading_spaces)); gtk_container_add (vgrid, create_subtitle_label (_("Spaces Inside Text"))); gtk_container_add (vgrid, GTK_WIDGET (prefs->priv->check_button_inside_text_tabs)); gtk_container_add (vgrid, GTK_WIDGET (prefs->priv->check_button_inside_text_spaces)); gtk_container_add (vgrid, create_subtitle_label (_("Trailing Spaces"))); gtk_container_add (vgrid, GTK_WIDGET (prefs->priv->check_button_trailing_tabs)); gtk_container_add (vgrid, GTK_WIDGET (prefs->priv->check_button_trailing_spaces)); gtk_container_add (vgrid, GTK_WIDGET (prefs->priv->check_button_newlines)); gtk_widget_show_all (GTK_WIDGET (vgrid)); gtk_container_add (GTK_CONTAINER (prefs), GTK_WIDGET (vgrid)); } static void matrix_notify_cb (GtkSourceSpaceDrawer *space_drawer, GParamSpec *pspec, TeplSpaceDrawerPrefs *prefs) { set_check_buttons_state_according_to_matrix (prefs); } static gchar * result_viewer_get_buffer_content (void) { const gchar *tab_desc = _("Tab"); const gchar *space_desc = _("Space"); const gchar *nbsp_desc = _("No-Break Space"); const gchar *narrow_nbsp_desc = _("Narrow No-Break Space"); return g_strconcat ("\t", tab_desc, "\t", tab_desc, "\t\n", " ", space_desc, " ", space_desc, " \n", "\xC2\xA0", nbsp_desc, "\xC2\xA0", nbsp_desc, "\xC2\xA0\n", "\xE2\x80\xAF", narrow_nbsp_desc, "\xE2\x80\xAF", narrow_nbsp_desc, "\xE2\x80\xAF", NULL); } static void add_result_viewer (TeplSpaceDrawerPrefs *prefs) { GtkSourceView *view; GtkTextBuffer *buffer; gchar *buffer_content; GtkSourceSpaceDrawer *space_drawer; GtkWidget *scrolled_window; gtk_container_add (GTK_CONTAINER (prefs->priv->second_column_vgrid), create_subtitle_label (_("Result"))); view = GTK_SOURCE_VIEW (gtk_source_view_new ()); gtk_source_view_set_show_line_numbers (view, TRUE); gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_monospace (GTK_TEXT_VIEW (view), TRUE); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); buffer_content = result_viewer_get_buffer_content (); gtk_text_buffer_set_text (buffer, buffer_content, -1); g_free (buffer_content); space_drawer = gtk_source_view_get_space_drawer (view); gtk_source_space_drawer_set_enable_matrix (space_drawer, TRUE); g_object_bind_property (prefs->priv->space_drawer, "matrix", space_drawer, "matrix", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (scrolled_window, 500, 120); gtk_widget_set_margin_start (scrolled_window, 12); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); gtk_scrolled_window_set_overlay_scrolling (GTK_SCROLLED_WINDOW (scrolled_window), FALSE); gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (view)); gtk_container_add (GTK_CONTAINER (prefs->priv->second_column_vgrid), scrolled_window); } static void add_information (TeplSpaceDrawerPrefs *prefs) { GtkLabel *label; gtk_container_add (GTK_CONTAINER (prefs->priv->second_column_vgrid), create_subtitle_label (_("Information"))); label = GTK_LABEL (gtk_label_new (_("When white space drawing is enabled, then non-breaking " "spaces are always drawn at all locations, to distinguish " "them from normal spaces."))); gtk_widget_set_margin_start (GTK_WIDGET (label), 12); gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_START); gtk_label_set_xalign (label, 0.0); gtk_label_set_line_wrap (label, TRUE); gtk_label_set_selectable (label, TRUE); gtk_label_set_max_width_chars (label, 60); gtk_container_add (GTK_CONTAINER (prefs->priv->second_column_vgrid), GTK_WIDGET (label)); } static void tepl_space_drawer_prefs_init (TeplSpaceDrawerPrefs *prefs) { prefs->priv = tepl_space_drawer_prefs_get_instance_private (prefs); gtk_orientable_set_orientation (GTK_ORIENTABLE (prefs), GTK_ORIENTATION_HORIZONTAL); gtk_grid_set_column_spacing (GTK_GRID (prefs), 24); g_object_set (prefs, "margin", 6, NULL); prefs->priv->space_drawer = gtk_source_space_drawer_new (); gtk_source_space_drawer_set_enable_matrix (prefs->priv->space_drawer, TRUE); gtk_source_space_drawer_set_types_for_locations (prefs->priv->space_drawer, GTK_SOURCE_SPACE_LOCATION_ALL, GTK_SOURCE_SPACE_TYPE_ALL & ~GTK_SOURCE_SPACE_TYPE_NEWLINE); add_check_buttons (prefs); g_signal_connect_object (prefs->priv->space_drawer, "notify::matrix", G_CALLBACK (matrix_notify_cb), prefs, 0); prefs->priv->second_column_vgrid = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (prefs->priv->second_column_vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (prefs->priv->second_column_vgrid, 6); gtk_container_add (GTK_CONTAINER (prefs), GTK_WIDGET (prefs->priv->second_column_vgrid)); add_result_viewer (prefs); add_information (prefs); gtk_widget_show_all (GTK_WIDGET (prefs->priv->second_column_vgrid)); } /** * tepl_space_drawer_prefs_new: * * Returns: (transfer floating): a new #TeplSpaceDrawerPrefs. * Since: 6.0 */ TeplSpaceDrawerPrefs * tepl_space_drawer_prefs_new (void) { return g_object_new (TEPL_TYPE_SPACE_DRAWER_PREFS, NULL); } /** * tepl_space_drawer_prefs_get_space_drawer: * @prefs: a #TeplSpaceDrawerPrefs. * * Gets the #GtkSourceSpaceDrawer associated with @prefs. The returned object is * guaranteed to be the same for the lifetime of @prefs. Each * #TeplSpaceDrawerPrefs object has a different #GtkSourceSpaceDrawer. * * Returns: (transfer none): the #GtkSourceSpaceDrawer associated with @prefs. * Since: 6.0 */ GtkSourceSpaceDrawer * tepl_space_drawer_prefs_get_space_drawer (TeplSpaceDrawerPrefs *prefs) { g_return_val_if_fail (TEPL_IS_SPACE_DRAWER_PREFS (prefs), NULL); return prefs->priv->space_drawer; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-space-drawer-prefs.h000066400000000000000000000034241526404732400277700ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_SPACE_DRAWER_PREFS_H #define TEPL_SPACE_DRAWER_PREFS_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_SPACE_DRAWER_PREFS (tepl_space_drawer_prefs_get_type ()) #define TEPL_SPACE_DRAWER_PREFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_SPACE_DRAWER_PREFS, TeplSpaceDrawerPrefs)) #define TEPL_SPACE_DRAWER_PREFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_SPACE_DRAWER_PREFS, TeplSpaceDrawerPrefsClass)) #define TEPL_IS_SPACE_DRAWER_PREFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_SPACE_DRAWER_PREFS)) #define TEPL_IS_SPACE_DRAWER_PREFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_SPACE_DRAWER_PREFS)) #define TEPL_SPACE_DRAWER_PREFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_SPACE_DRAWER_PREFS, TeplSpaceDrawerPrefsClass)) typedef struct _TeplSpaceDrawerPrefs TeplSpaceDrawerPrefs; typedef struct _TeplSpaceDrawerPrefsClass TeplSpaceDrawerPrefsClass; typedef struct _TeplSpaceDrawerPrefsPrivate TeplSpaceDrawerPrefsPrivate; struct _TeplSpaceDrawerPrefs { GtkGrid parent; TeplSpaceDrawerPrefsPrivate *priv; }; struct _TeplSpaceDrawerPrefsClass { GtkGridClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_space_drawer_prefs_get_type (void); G_MODULE_EXPORT TeplSpaceDrawerPrefs * tepl_space_drawer_prefs_new (void); G_MODULE_EXPORT GtkSourceSpaceDrawer * tepl_space_drawer_prefs_get_space_drawer (TeplSpaceDrawerPrefs *prefs); G_END_DECLS #endif /* TEPL_SPACE_DRAWER_PREFS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-status-menu-button.c000066400000000000000000000074121526404732400300700ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2008 - Jesse van den Kieboom * SPDX-FileCopyrightText: 2023 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-status-menu-button.h" #include "tepl-utils.h" /** * SECTION:status-menu-button * @Title: TeplStatusMenuButton * @Short_description: A #GtkMenuButton suitable for #GtkStatusbar * * #TeplStatusMenuButton is a #GtkMenuButton that is suitable to be put in a * #GtkStatusbar. * * It contains: * - Some text. * - An arrow. * - When clicked, a menu or popover can be shown (see the #GtkMenuButton API). */ struct _TeplStatusMenuButtonPrivate { GtkLabel *label; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplStatusMenuButton, tepl_status_menu_button, GTK_TYPE_MENU_BUTTON) static void tepl_status_menu_button_dispose (GObject *object) { TeplStatusMenuButton *button = TEPL_STATUS_MENU_BUTTON (object); button->priv->label = NULL; G_OBJECT_CLASS (tepl_status_menu_button_parent_class)->dispose (object); } static void tepl_status_menu_button_class_init (TeplStatusMenuButtonClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_status_menu_button_dispose; } static void create_label (TeplStatusMenuButton *button) { g_return_if_fail (button->priv->label == NULL); button->priv->label = GTK_LABEL (gtk_label_new (NULL)); gtk_widget_set_valign (GTK_WIDGET (button->priv->label), GTK_ALIGN_BASELINE); gtk_label_set_single_line_mode (button->priv->label, TRUE); } static void apply_css (TeplStatusMenuButton *button) { GtkCssProvider *css_provider; GtkStyleContext *style_context; GError *error = NULL; const gchar *css_style = "button {\n" " padding: 0px 3px;\n" " border: none;\n" " border-radius: 0;\n" " outline-style: none;\n" "}\n"; css_provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (css_provider, css_style, -1, &error); if (error != NULL) { g_warning ("TeplStatusMenuButton CSS error: %s", error->message); g_clear_error (&error); } style_context = gtk_widget_get_style_context (GTK_WIDGET (button)); gtk_style_context_add_provider (style_context, GTK_STYLE_PROVIDER (css_provider), TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY); g_object_unref (css_provider); } static void tepl_status_menu_button_init (TeplStatusMenuButton *button) { GtkWidget *arrow; GtkGrid *hgrid; button->priv = tepl_status_menu_button_get_instance_private (button); create_label (button); arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); gtk_widget_set_valign (arrow, GTK_ALIGN_BASELINE); hgrid = GTK_GRID (gtk_grid_new ()); gtk_grid_set_column_spacing (hgrid, 3); gtk_widget_set_valign (GTK_WIDGET (hgrid), GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (hgrid), GTK_WIDGET (button->priv->label)); gtk_container_add (GTK_CONTAINER (hgrid), arrow); gtk_widget_show_all (GTK_WIDGET (hgrid)); gtk_container_add (GTK_CONTAINER (button), GTK_WIDGET (hgrid)); gtk_menu_button_set_direction (GTK_MENU_BUTTON (button), GTK_ARROW_UP); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); apply_css (button); } /** * tepl_status_menu_button_new: * * Returns: (transfer floating): a new #TeplStatusMenuButton widget. * Since: 6.8 */ TeplStatusMenuButton * tepl_status_menu_button_new (void) { return g_object_new (TEPL_TYPE_STATUS_MENU_BUTTON, NULL); } /** * tepl_status_menu_button_set_label_text: * @button: a #TeplStatusMenuButton. * @str: the text to set. * * To change the text displayed in @button. * * Since: 6.8 */ void tepl_status_menu_button_set_label_text (TeplStatusMenuButton *button, const gchar *str) { g_return_if_fail (TEPL_IS_STATUS_MENU_BUTTON (button)); g_return_if_fail (str != NULL); gtk_label_set_label (button->priv->label, str); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-status-menu-button.h000066400000000000000000000035311526404732400300730ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2008 - Jesse van den Kieboom * SPDX-FileCopyrightText: 2023 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_STATUS_MENU_BUTTON_H #define TEPL_STATUS_MENU_BUTTON_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_STATUS_MENU_BUTTON (tepl_status_menu_button_get_type ()) #define TEPL_STATUS_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_STATUS_MENU_BUTTON, TeplStatusMenuButton)) #define TEPL_STATUS_MENU_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_STATUS_MENU_BUTTON, TeplStatusMenuButtonClass)) #define TEPL_IS_STATUS_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_STATUS_MENU_BUTTON)) #define TEPL_IS_STATUS_MENU_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_STATUS_MENU_BUTTON)) #define TEPL_STATUS_MENU_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_STATUS_MENU_BUTTON, TeplStatusMenuButtonClass)) typedef struct _TeplStatusMenuButton TeplStatusMenuButton; typedef struct _TeplStatusMenuButtonClass TeplStatusMenuButtonClass; typedef struct _TeplStatusMenuButtonPrivate TeplStatusMenuButtonPrivate; struct _TeplStatusMenuButton { GtkMenuButton parent; TeplStatusMenuButtonPrivate *priv; }; struct _TeplStatusMenuButtonClass { GtkMenuButtonClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_status_menu_button_get_type (void); G_MODULE_EXPORT TeplStatusMenuButton * tepl_status_menu_button_new (void); G_MODULE_EXPORT void tepl_status_menu_button_set_label_text (TeplStatusMenuButton *button, const gchar *str); G_END_DECLS #endif /* TEPL_STATUS_MENU_BUTTON_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-statusbar.c000066400000000000000000000075651526404732400263130ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2005 - Paolo Borelli * SPDX-FileCopyrightText: 2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-statusbar.h" #include "tepl-utils.h" /** * SECTION:statusbar * @Title: TeplStatusbar * @Short_description: Subclass of #GtkStatusbar * * #TeplStatusbar is a subclass of #GtkStatusbar with additional features. * * The tepl_utils_setup_statusbar() function is already called. */ struct _TeplStatusbarPrivate { guint generic_message_context_id; /* Flash timeout data */ guint flash_timeout_id; guint flash_context_id; guint flash_message_id; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplStatusbar, tepl_statusbar, GTK_TYPE_STATUSBAR) static void tepl_statusbar_dispose (GObject *object) { TeplStatusbar *statusbar = TEPL_STATUSBAR (object); g_clear_handle_id (&statusbar->priv->flash_timeout_id, g_source_remove); G_OBJECT_CLASS (tepl_statusbar_parent_class)->dispose (object); } static void tepl_statusbar_class_init (TeplStatusbarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_statusbar_dispose; } static void tepl_statusbar_init (TeplStatusbar *statusbar) { statusbar->priv = tepl_statusbar_get_instance_private (statusbar); statusbar->priv->generic_message_context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar), "generic_message"); tepl_utils_setup_statusbar (GTK_STATUSBAR (statusbar)); gtk_widget_set_hexpand (GTK_WIDGET (statusbar), TRUE); } /** * tepl_statusbar_new: * * Returns: (transfer floating): a new #TeplStatusbar. * Since: 6.14 */ TeplStatusbar * tepl_statusbar_new (void) { return g_object_new (TEPL_TYPE_STATUSBAR, NULL); } static gboolean flash_timeout_cb (gpointer user_data) { TeplStatusbar *statusbar = TEPL_STATUSBAR (user_data); gtk_statusbar_remove (GTK_STATUSBAR (statusbar), statusbar->priv->flash_context_id, statusbar->priv->flash_message_id); statusbar->priv->flash_timeout_id = 0; return G_SOURCE_REMOVE; } /** * tepl_statusbar_flash_message: * @statusbar: a #TeplStatusbar. * @context_id: a context ID obtained with gtk_statusbar_get_context_id(). * @msg: the message. * * Flashes a temporary message on the statusbar. * * The message is displayed during a short amount of time and then disappears * automatically. * * Since: 6.14 */ void tepl_statusbar_flash_message (TeplStatusbar *statusbar, guint context_id, const gchar *msg) { g_return_if_fail (TEPL_IS_STATUSBAR (statusbar)); g_return_if_fail (msg != NULL); /* Remove a currently ongoing flash message. */ if (statusbar->priv->flash_timeout_id > 0) { g_source_remove (statusbar->priv->flash_timeout_id); statusbar->priv->flash_timeout_id = 0; gtk_statusbar_remove (GTK_STATUSBAR (statusbar), statusbar->priv->flash_context_id, statusbar->priv->flash_message_id); } statusbar->priv->flash_context_id = context_id; statusbar->priv->flash_message_id = gtk_statusbar_push (GTK_STATUSBAR (statusbar), context_id, msg); /* Flash duration: 3 seconds. * g_timeout_add_seconds() is not used to ensure a good precision. */ statusbar->priv->flash_timeout_id = g_timeout_add (3000, flash_timeout_cb, statusbar); } /** * tepl_statusbar_flash_generic_message: * @statusbar: a #TeplStatusbar. * @msg: the message. * * Like tepl_statusbar_flash_message() but using a generic @context_id. * * If you need to call gtk_statusbar_remove_all() or gtk_statusbar_pop(), then * use tepl_statusbar_flash_message() instead. Otherwise using this function is * sufficient. * * Since: 6.14 */ void tepl_statusbar_flash_generic_message (TeplStatusbar *statusbar, const gchar *msg) { g_return_if_fail (TEPL_IS_STATUSBAR (statusbar)); g_return_if_fail (msg != NULL); tepl_statusbar_flash_message (statusbar, statusbar->priv->generic_message_context_id, msg); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-statusbar.h000066400000000000000000000031561526404732400263100ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2005 - Paolo Borelli * SPDX-FileCopyrightText: 2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #pragma once #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_STATUSBAR (tepl_statusbar_get_type ()) #define TEPL_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_STATUSBAR, TeplStatusbar)) #define TEPL_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_STATUSBAR, TeplStatusbarClass)) #define TEPL_IS_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_STATUSBAR)) #define TEPL_IS_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_STATUSBAR)) #define TEPL_STATUSBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_STATUSBAR, TeplStatusbarClass)) typedef struct _TeplStatusbar TeplStatusbar; typedef struct _TeplStatusbarClass TeplStatusbarClass; typedef struct _TeplStatusbarPrivate TeplStatusbarPrivate; struct _TeplStatusbar { GtkStatusbar parent; TeplStatusbarPrivate *priv; }; struct _TeplStatusbarClass { GtkStatusbarClass parent_class; }; G_MODULE_EXPORT GType tepl_statusbar_get_type (void); G_MODULE_EXPORT TeplStatusbar * tepl_statusbar_new (void); G_MODULE_EXPORT void tepl_statusbar_flash_message (TeplStatusbar *statusbar, guint context_id, const gchar *msg); G_MODULE_EXPORT void tepl_statusbar_flash_generic_message (TeplStatusbar *statusbar, const gchar *msg); G_END_DECLS libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-style-scheme-chooser-full.c000066400000000000000000000140531526404732400312730ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-style-scheme-chooser-full.h" #include #include #include "tepl-style-scheme-chooser-simple.h" #include "tepl-settings.h" /** * SECTION:style-scheme-chooser-full * @Title: TeplStyleSchemeChooserFull * @Short_description: A #GtkSourceStyleScheme chooser widget for light and dark themes * * #TeplStyleSchemeChooserFull is a widget that permits to choose a * #GtkSourceStyleScheme. * * It is similar to #TeplStyleSchemeChooserSimple, but supports both light and * dark GTK themes in a single widget. * * #TeplStyleSchemeChooserFull has a title for the component. The title * describes whether it is for a light or dark GTK theme. There is only one list * of style schemes shown, and it dynamically changes depending on the GTK * theme. * * It connects to the two #GSettings keys provided by * tepl_settings_provide_style_scheme_settings(). */ struct _TeplStyleSchemeChooserFullPrivate { /* The title of the component. */ GtkLabel *label; /* Only one of the two is visible at a time. */ TeplStyleSchemeChooserSimple *simple_chooser_for_light_theme; TeplStyleSchemeChooserSimple *simple_chooser_for_dark_theme; }; G_DEFINE_TYPE_WITH_PRIVATE (TeplStyleSchemeChooserFull, tepl_style_scheme_chooser_full, GTK_TYPE_BIN) static GtkLabel * create_label (void) { GtkLabel *label; label = GTK_LABEL (gtk_label_new (NULL)); gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_START); return label; } static TeplStyleSchemeChooserSimple * create_simple_chooser (gboolean for_dark_theme_variant) { TeplStyleSchemeChooserSimple *simple_chooser; simple_chooser = tepl_style_scheme_chooser_simple_new (for_dark_theme_variant); gtk_widget_set_no_show_all (GTK_WIDGET (simple_chooser), TRUE); /* To do like tepl_utils_get_titled_component(). */ gtk_widget_set_margin_start (GTK_WIDGET (simple_chooser), 12); return simple_chooser; } static GtkContainer * create_vgrid (void) { GtkContainer *vgrid; vgrid = GTK_CONTAINER (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 6); return vgrid; } static void update_label (TeplStyleSchemeChooserFull *chooser) { const gchar *text; gchar *markup; if (hdy_style_manager_get_dark (hdy_style_manager_get_default ())) { text = _("Color Scheme for the Dark Theme Variant"); } else { text = _("Color Scheme for the Light Theme Variant"); } markup = g_strdup_printf ("%s", text); gtk_label_set_markup (chooser->priv->label, markup); g_free (markup); } static void update_simple_choosers_visibility (TeplStyleSchemeChooserFull *chooser) { gboolean theme_is_dark; theme_is_dark = hdy_style_manager_get_dark (hdy_style_manager_get_default ()); gtk_widget_set_visible (GTK_WIDGET (chooser->priv->simple_chooser_for_light_theme), !theme_is_dark); gtk_widget_set_visible (GTK_WIDGET (chooser->priv->simple_chooser_for_dark_theme), theme_is_dark); } static void theme_variant_notify_cb (HdyStyleManager *style_manager, GParamSpec *pspec, TeplStyleSchemeChooserFull *chooser) { update_label (chooser); update_simple_choosers_visibility (chooser); } static void bind_settings (TeplStyleSchemeChooserFull *chooser) { GSettings *settings; const gchar *key_for_light_theme_variant = NULL; const gchar *key_for_dark_theme_variant = NULL; settings = _tepl_settings_get_style_scheme_settings (tepl_settings_get_singleton (), &key_for_light_theme_variant, &key_for_dark_theme_variant); if (settings == NULL) { return; } if (key_for_light_theme_variant != NULL) { g_settings_bind (settings, key_for_light_theme_variant, chooser->priv->simple_chooser_for_light_theme, "style-scheme-id", G_SETTINGS_BIND_DEFAULT); } if (key_for_dark_theme_variant != NULL) { g_settings_bind (settings, key_for_dark_theme_variant, chooser->priv->simple_chooser_for_dark_theme, "style-scheme-id", G_SETTINGS_BIND_DEFAULT); } } static void tepl_style_scheme_chooser_full_dispose (GObject *object) { TeplStyleSchemeChooserFull *chooser = TEPL_STYLE_SCHEME_CHOOSER_FULL (object); chooser->priv->label = NULL; chooser->priv->simple_chooser_for_light_theme = NULL; chooser->priv->simple_chooser_for_dark_theme = NULL; G_OBJECT_CLASS (tepl_style_scheme_chooser_full_parent_class)->dispose (object); } static void tepl_style_scheme_chooser_full_class_init (TeplStyleSchemeChooserFullClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = tepl_style_scheme_chooser_full_dispose; } static void tepl_style_scheme_chooser_full_init (TeplStyleSchemeChooserFull *chooser) { GtkContainer *vgrid; chooser->priv = tepl_style_scheme_chooser_full_get_instance_private (chooser); /* Create individual widgets */ chooser->priv->label = create_label (); chooser->priv->simple_chooser_for_light_theme = create_simple_chooser (FALSE); chooser->priv->simple_chooser_for_dark_theme = create_simple_chooser (TRUE); vgrid = create_vgrid (); /* Packing */ gtk_container_add (vgrid, GTK_WIDGET (chooser->priv->label)); gtk_container_add (vgrid, GTK_WIDGET (chooser->priv->simple_chooser_for_light_theme)); gtk_container_add (vgrid, GTK_WIDGET (chooser->priv->simple_chooser_for_dark_theme)); gtk_container_add (GTK_CONTAINER (chooser), GTK_WIDGET (vgrid)); gtk_widget_show_all (GTK_WIDGET (chooser)); /* Connect to signals */ g_signal_connect_object (hdy_style_manager_get_default (), "notify::dark", G_CALLBACK (theme_variant_notify_cb), chooser, G_CONNECT_DEFAULT); /* Update state */ update_label (chooser); update_simple_choosers_visibility (chooser); bind_settings (chooser); } /** * tepl_style_scheme_chooser_full_new: * * Returns: (transfer floating): a new #TeplStyleSchemeChooserFull widget. * Since: 6.11 */ TeplStyleSchemeChooserFull * tepl_style_scheme_chooser_full_new (void) { return g_object_new (TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL, NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-style-scheme-chooser-full.h000066400000000000000000000035321526404732400313000ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_STYLE_SCHEME_CHOOSER_FULL_H #define TEPL_STYLE_SCHEME_CHOOSER_FULL_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL (tepl_style_scheme_chooser_full_get_type ()) #define TEPL_STYLE_SCHEME_CHOOSER_FULL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL, TeplStyleSchemeChooserFull)) #define TEPL_STYLE_SCHEME_CHOOSER_FULL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL, TeplStyleSchemeChooserFullClass)) #define TEPL_IS_STYLE_SCHEME_CHOOSER_FULL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL)) #define TEPL_IS_STYLE_SCHEME_CHOOSER_FULL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL)) #define TEPL_STYLE_SCHEME_CHOOSER_FULL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_STYLE_SCHEME_CHOOSER_FULL, TeplStyleSchemeChooserFullClass)) typedef struct _TeplStyleSchemeChooserFull TeplStyleSchemeChooserFull; typedef struct _TeplStyleSchemeChooserFullClass TeplStyleSchemeChooserFullClass; typedef struct _TeplStyleSchemeChooserFullPrivate TeplStyleSchemeChooserFullPrivate; struct _TeplStyleSchemeChooserFull { GtkBin parent; TeplStyleSchemeChooserFullPrivate *priv; }; struct _TeplStyleSchemeChooserFullClass { GtkBinClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_style_scheme_chooser_full_get_type (void); G_MODULE_EXPORT TeplStyleSchemeChooserFull * tepl_style_scheme_chooser_full_new (void); G_END_DECLS #endif /* TEPL_STYLE_SCHEME_CHOOSER_FULL_H */ tepl-style-scheme-chooser-simple.c000066400000000000000000000274721526404732400315540ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-style-scheme-chooser-simple.h" #include "tepl-style-scheme-row.h" #include "tepl-utils.h" /** * SECTION:style-scheme-chooser-simple * @Title: TeplStyleSchemeChooserSimple * @Short_description: A simple #GtkSourceStyleScheme chooser widget * * #TeplStyleSchemeChooserSimple is a widget that permits to choose a * #GtkSourceStyleScheme. * * It shows a list with the name and description of each #GtkSourceStyleScheme, * taken from the default #GtkSourceStyleSchemeManager. * * It is either for a light GTK theme, or a dark GTK theme, but not both. If you * need both, consider using #TeplStyleSchemeChooserFull or create two instances * of #TeplStyleSchemeChooserSimple. * * #TeplStyleSchemeChooserSimple contains a #GtkScrolledWindow internally. When * the #GtkWidget::map signal is emitted, it scrolls to the selected row (useful * when the list is long). */ struct _TeplStyleSchemeChooserSimplePrivate { /* Contains TeplStyleSchemeRow's. */ GtkListBox *list_box; /* For the property. */ gchar *style_scheme_id; guint for_dark_theme_variant : 1; }; enum { PROP_0, PROP_STYLE_SCHEME_ID, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; G_DEFINE_TYPE_WITH_PRIVATE (TeplStyleSchemeChooserSimple, tepl_style_scheme_chooser_simple, GTK_TYPE_BIN) static GtkListBox * create_list_box (void) { GtkListBox *list_box; list_box = GTK_LIST_BOX (gtk_list_box_new ()); gtk_list_box_set_selection_mode (list_box, GTK_SELECTION_BROWSE); return list_box; } static GtkScrolledWindow * create_scrolled_window (void) { GtkScrolledWindow *scrolled_window; scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL)); gtk_widget_set_hexpand (GTK_WIDGET (scrolled_window), TRUE); gtk_widget_set_vexpand (GTK_WIDGET (scrolled_window), TRUE); gtk_scrolled_window_set_shadow_type (scrolled_window, GTK_SHADOW_IN); /* Improve the minimum height, to avoid the vertical scrollbar by * default (with the default list of style schemes provided by * libgedit-gtksourceview). */ gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), -1, 200); /* Overlay scrolling gets in the way when trying to select the last row. */ gtk_scrolled_window_set_overlay_scrolling (scrolled_window, FALSE); return scrolled_window; } static void populate_list_box (TeplStyleSchemeChooserSimple *chooser) { GtkSourceStyleSchemeManager *manager; GList *schemes; GList *l; manager = gtk_source_style_scheme_manager_get_default (); schemes = gtk_source_style_scheme_manager_get_schemes (manager); for (l = schemes; l != NULL; l = l->next) { GtkSourceStyleScheme *style_scheme = GTK_SOURCE_STYLE_SCHEME (l->data); TeplStyleSchemeRow *row; row = _tepl_style_scheme_row_new (style_scheme, chooser->priv->for_dark_theme_variant); gtk_list_box_insert (chooser->priv->list_box, GTK_WIDGET (row), -1); } g_list_free (schemes); } /* Sync selected-row -> style-scheme-id property. */ static void update_style_scheme_id_property (TeplStyleSchemeChooserSimple *chooser) { GtkListBoxRow *selected_row; const gchar *id = NULL; selected_row = gtk_list_box_get_selected_row (chooser->priv->list_box); if (selected_row != NULL) { GtkSourceStyleScheme *style_scheme; style_scheme = _tepl_style_scheme_row_get_style_scheme (TEPL_STYLE_SCHEME_ROW (selected_row)); id = gtk_source_style_scheme_get_id (style_scheme); } /* Do not call tepl_style_scheme_chooser_simple_set_style_scheme_id() * because we don't want update_selected_row() to be called here. */ if (g_set_str (&chooser->priv->style_scheme_id, id)) { g_object_notify_by_pspec (G_OBJECT (chooser), properties[PROP_STYLE_SCHEME_ID]); } } /* Sync style-scheme-id property -> selected-row. */ static void update_selected_row (TeplStyleSchemeChooserSimple *chooser) { GList *all_rows; GList *l; gtk_list_box_unselect_all (chooser->priv->list_box); if (chooser->priv->style_scheme_id == NULL) { return; } all_rows = gtk_container_get_children (GTK_CONTAINER (chooser->priv->list_box)); for (l = all_rows; l != NULL; l = l->next) { TeplStyleSchemeRow *row = TEPL_STYLE_SCHEME_ROW (l->data); GtkSourceStyleScheme *style_scheme; const gchar *id; style_scheme = _tepl_style_scheme_row_get_style_scheme (row); id = gtk_source_style_scheme_get_id (style_scheme); if (g_strcmp0 (chooser->priv->style_scheme_id, id) == 0 && gtk_list_box_row_get_selectable (GTK_LIST_BOX_ROW (row))) { gtk_list_box_select_row (chooser->priv->list_box, GTK_LIST_BOX_ROW (row)); tepl_utils_list_box_scroll_to_row (chooser->priv->list_box, GTK_LIST_BOX_ROW (row)); break; } } g_list_free (all_rows); } static void list_box_selected_rows_changed_cb (GtkListBox *list_box, TeplStyleSchemeChooserSimple *chooser) { update_style_scheme_id_property (chooser); } static void full_repopulate (TeplStyleSchemeChooserSimple *chooser) { g_signal_handlers_block_by_func (chooser->priv->list_box, list_box_selected_rows_changed_cb, chooser); tepl_utils_list_box_clear (chooser->priv->list_box); populate_list_box (chooser); update_selected_row (chooser); g_signal_handlers_unblock_by_func (chooser->priv->list_box, list_box_selected_rows_changed_cb, chooser); } static void style_scheme_manager_changed_cb (GtkSourceStyleSchemeManager *manager, TeplStyleSchemeChooserSimple *chooser) { full_repopulate (chooser); } static void tepl_style_scheme_chooser_simple_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplStyleSchemeChooserSimple *chooser = TEPL_STYLE_SCHEME_CHOOSER_SIMPLE (object); switch (prop_id) { case PROP_STYLE_SCHEME_ID: g_value_set_string (value, tepl_style_scheme_chooser_simple_get_style_scheme_id (chooser)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_style_scheme_chooser_simple_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplStyleSchemeChooserSimple *chooser = TEPL_STYLE_SCHEME_CHOOSER_SIMPLE (object); switch (prop_id) { case PROP_STYLE_SCHEME_ID: tepl_style_scheme_chooser_simple_set_style_scheme_id (chooser, g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_style_scheme_chooser_simple_dispose (GObject *object) { TeplStyleSchemeChooserSimple *chooser = TEPL_STYLE_SCHEME_CHOOSER_SIMPLE (object); chooser->priv->list_box = NULL; G_OBJECT_CLASS (tepl_style_scheme_chooser_simple_parent_class)->dispose (object); } static void tepl_style_scheme_chooser_simple_finalize (GObject *object) { TeplStyleSchemeChooserSimple *chooser = TEPL_STYLE_SCHEME_CHOOSER_SIMPLE (object); g_free (chooser->priv->style_scheme_id); G_OBJECT_CLASS (tepl_style_scheme_chooser_simple_parent_class)->finalize (object); } static void tepl_style_scheme_chooser_simple_map (GtkWidget *widget) { TeplStyleSchemeChooserSimple *chooser = TEPL_STYLE_SCHEME_CHOOSER_SIMPLE (widget); if (GTK_WIDGET_CLASS (tepl_style_scheme_chooser_simple_parent_class)->map != NULL) { GTK_WIDGET_CLASS (tepl_style_scheme_chooser_simple_parent_class)->map (widget); } tepl_utils_list_box_scroll_to_selected_row (chooser->priv->list_box); } static void tepl_style_scheme_chooser_simple_class_init (TeplStyleSchemeChooserSimpleClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->get_property = tepl_style_scheme_chooser_simple_get_property; object_class->set_property = tepl_style_scheme_chooser_simple_set_property; object_class->dispose = tepl_style_scheme_chooser_simple_dispose; object_class->finalize = tepl_style_scheme_chooser_simple_finalize; widget_class->map = tepl_style_scheme_chooser_simple_map; /** * TeplStyleSchemeChooserSimple:style-scheme-id: * * The selected #GtkSourceStyleScheme ID. * * Its value changes when the user selects another row in the list. * * When set, if the ID doesn't exist, no row is selected. * * Since: 6.11 */ properties[PROP_STYLE_SCHEME_ID] = g_param_spec_string ("style-scheme-id", "style-scheme-id", "", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void tepl_style_scheme_chooser_simple_init (TeplStyleSchemeChooserSimple *chooser) { GtkScrolledWindow *scrolled_window; chooser->priv = tepl_style_scheme_chooser_simple_get_instance_private (chooser); chooser->priv->list_box = create_list_box (); scrolled_window = create_scrolled_window (); gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (chooser->priv->list_box)); tepl_utils_list_box_setup_scrolling (chooser->priv->list_box, scrolled_window); gtk_container_add (GTK_CONTAINER (chooser), GTK_WIDGET (scrolled_window)); gtk_widget_show_all (GTK_WIDGET (chooser)); } /** * tepl_style_scheme_chooser_simple_new: * @for_dark_theme_variant: whether it's for choosing a style scheme for a dark * GTK theme variant. * * Creates a new #TeplStyleSchemeChooserSimple widget. * * The content of the widget will be different depending on * @for_dark_theme_variant. That configuration cannot change once the widget is * created. If your application supports both the light and dark GTK theme * variants, consider using #TeplStyleSchemeChooserFull instead. * * Returns: (transfer floating): a new #TeplStyleSchemeChooserSimple widget. * Since: 6.11 */ TeplStyleSchemeChooserSimple * tepl_style_scheme_chooser_simple_new (gboolean for_dark_theme_variant) { TeplStyleSchemeChooserSimple *chooser; chooser = g_object_new (TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE, NULL); chooser->priv->for_dark_theme_variant = for_dark_theme_variant != FALSE; g_signal_connect (chooser->priv->list_box, "selected-rows-changed", G_CALLBACK (list_box_selected_rows_changed_cb), chooser); g_signal_connect_object (gtk_source_style_scheme_manager_get_default (), "changed", G_CALLBACK (style_scheme_manager_changed_cb), chooser, G_CONNECT_DEFAULT); full_repopulate (chooser); return chooser; } /** * tepl_style_scheme_chooser_simple_get_style_scheme_id: * @chooser: a #TeplStyleSchemeChooserSimple. * * Returns: (nullable): the value of the * #TeplStyleSchemeChooserSimple:style-scheme-id property. * Since: 6.11 */ const gchar * tepl_style_scheme_chooser_simple_get_style_scheme_id (TeplStyleSchemeChooserSimple *chooser) { g_return_val_if_fail (TEPL_IS_STYLE_SCHEME_CHOOSER_SIMPLE (chooser), NULL); return chooser->priv->style_scheme_id; } /** * tepl_style_scheme_chooser_simple_set_style_scheme_id: * @chooser: a #TeplStyleSchemeChooserSimple. * @style_scheme_id: the new value. * * Sets the #TeplStyleSchemeChooserSimple:style-scheme-id property. * * Since: 6.11 */ void tepl_style_scheme_chooser_simple_set_style_scheme_id (TeplStyleSchemeChooserSimple *chooser, const gchar *style_scheme_id) { g_return_if_fail (TEPL_IS_STYLE_SCHEME_CHOOSER_SIMPLE (chooser)); if (g_set_str (&chooser->priv->style_scheme_id, style_scheme_id)) { g_signal_handlers_block_by_func (chooser->priv->list_box, list_box_selected_rows_changed_cb, chooser); update_selected_row (chooser); g_signal_handlers_unblock_by_func (chooser->priv->list_box, list_box_selected_rows_changed_cb, chooser); g_object_notify_by_pspec (G_OBJECT (chooser), properties[PROP_STYLE_SCHEME_ID]); } } tepl-style-scheme-chooser-simple.h000066400000000000000000000043061526404732400315500ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_STYLE_SCHEME_CHOOSER_SIMPLE_H #define TEPL_STYLE_SCHEME_CHOOSER_SIMPLE_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE (tepl_style_scheme_chooser_simple_get_type ()) #define TEPL_STYLE_SCHEME_CHOOSER_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE, TeplStyleSchemeChooserSimple)) #define TEPL_STYLE_SCHEME_CHOOSER_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE, TeplStyleSchemeChooserSimpleClass)) #define TEPL_IS_STYLE_SCHEME_CHOOSER_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE)) #define TEPL_IS_STYLE_SCHEME_CHOOSER_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE)) #define TEPL_STYLE_SCHEME_CHOOSER_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_STYLE_SCHEME_CHOOSER_SIMPLE, TeplStyleSchemeChooserSimpleClass)) typedef struct _TeplStyleSchemeChooserSimple TeplStyleSchemeChooserSimple; typedef struct _TeplStyleSchemeChooserSimpleClass TeplStyleSchemeChooserSimpleClass; typedef struct _TeplStyleSchemeChooserSimplePrivate TeplStyleSchemeChooserSimplePrivate; struct _TeplStyleSchemeChooserSimple { GtkBin parent; TeplStyleSchemeChooserSimplePrivate *priv; }; struct _TeplStyleSchemeChooserSimpleClass { GtkBinClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_style_scheme_chooser_simple_get_type (void); G_MODULE_EXPORT TeplStyleSchemeChooserSimple * tepl_style_scheme_chooser_simple_new (gboolean for_dark_theme_variant); G_MODULE_EXPORT const gchar * tepl_style_scheme_chooser_simple_get_style_scheme_id (TeplStyleSchemeChooserSimple *chooser); G_MODULE_EXPORT void tepl_style_scheme_chooser_simple_set_style_scheme_id (TeplStyleSchemeChooserSimple *chooser, const gchar *style_scheme_id); G_END_DECLS #endif /* TEPL_STYLE_SCHEME_CHOOSER_SIMPLE_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-style-scheme-row.c000066400000000000000000000077251526404732400275100ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-style-scheme-row.h" #include /* A GtkListBoxRow to be used in the GtkListBox of TeplStyleSchemeChooserWidget. * The row is something static. It does *not* change automatically when the * theme variant changes; when that happens, a new row needs to be created with * the new configuration. */ struct _TeplStyleSchemeRowPrivate { GtkSourceStyleScheme *style_scheme; /* owned */ }; G_DEFINE_TYPE_WITH_PRIVATE (TeplStyleSchemeRow, _tepl_style_scheme_row, GTK_TYPE_LIST_BOX_ROW) static gboolean is_supported (TeplStyleSchemeRow *row, gboolean for_dark_theme_variant) { GtkSourceStyleSchemeKind kind; kind = gtk_source_style_scheme_get_kind (row->priv->style_scheme); switch (kind) { case GTK_SOURCE_STYLE_SCHEME_KIND_LIGHT: case GTK_SOURCE_STYLE_SCHEME_KIND_DARK: return TRUE; case GTK_SOURCE_STYLE_SCHEME_KIND_LIGHT_ONLY: return !for_dark_theme_variant; case GTK_SOURCE_STYLE_SCHEME_KIND_DARK_ONLY: return for_dark_theme_variant; default: break; } g_return_val_if_reached (FALSE); } static const gchar * get_description (TeplStyleSchemeRow *row, gboolean for_dark_theme_variant) { if (is_supported (row, for_dark_theme_variant)) { return gtk_source_style_scheme_get_description (row->priv->style_scheme); } /* Instead of hiding the style schemes that are unsupported, show them * with a message. That way the user understands, to know that there * isn't a bug (no issues to report). * Normally (at least with the default style schemes) the number of * unsupported style schemes is small, so it's not a problem to add them * to the list. */ if (for_dark_theme_variant) { return _("Unsupported for the dark theme variant"); } return _("Unsupported for the light theme variant"); } static void _tepl_style_scheme_row_dispose (GObject *object) { TeplStyleSchemeRow *row = TEPL_STYLE_SCHEME_ROW (object); g_clear_object (&row->priv->style_scheme); G_OBJECT_CLASS (_tepl_style_scheme_row_parent_class)->dispose (object); } static void _tepl_style_scheme_row_class_init (TeplStyleSchemeRowClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = _tepl_style_scheme_row_dispose; } static void _tepl_style_scheme_row_init (TeplStyleSchemeRow *row) { row->priv = _tepl_style_scheme_row_get_instance_private (row); } static void add_label (TeplStyleSchemeRow *row, gboolean for_dark_theme_variant) { const gchar *name; const gchar *description; gchar *markup; GtkWidget *label; name = gtk_source_style_scheme_get_name (row->priv->style_scheme); description = get_description (row, for_dark_theme_variant); if (description != NULL) { markup = g_markup_printf_escaped ("%s - %s", name, description); } else { markup = g_markup_printf_escaped ("%s", name); } label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), markup); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_container_add (GTK_CONTAINER (row), label); g_free (markup); } TeplStyleSchemeRow * _tepl_style_scheme_row_new (GtkSourceStyleScheme *style_scheme, gboolean for_dark_theme_variant) { TeplStyleSchemeRow *row; gboolean selectable; g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME (style_scheme), NULL); row = g_object_new (TEPL_TYPE_STYLE_SCHEME_ROW, NULL); row->priv->style_scheme = g_object_ref (style_scheme); add_label (row, for_dark_theme_variant); selectable = is_supported (row, for_dark_theme_variant); gtk_list_box_row_set_selectable (GTK_LIST_BOX_ROW (row), selectable); gtk_widget_set_sensitive (GTK_WIDGET (row), selectable); gtk_widget_show_all (GTK_WIDGET (row)); return row; } GtkSourceStyleScheme * _tepl_style_scheme_row_get_style_scheme (TeplStyleSchemeRow *row) { g_return_val_if_fail (TEPL_IS_STYLE_SCHEME_ROW (row), NULL); return row->priv->style_scheme; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-style-scheme-row.h000066400000000000000000000032201526404732400274770ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_STYLE_SCHEME_ROW_H #define TEPL_STYLE_SCHEME_ROW_H #include G_BEGIN_DECLS #define TEPL_TYPE_STYLE_SCHEME_ROW (_tepl_style_scheme_row_get_type ()) #define TEPL_STYLE_SCHEME_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_STYLE_SCHEME_ROW, TeplStyleSchemeRow)) #define TEPL_STYLE_SCHEME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_STYLE_SCHEME_ROW, TeplStyleSchemeRowClass)) #define TEPL_IS_STYLE_SCHEME_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_STYLE_SCHEME_ROW)) #define TEPL_IS_STYLE_SCHEME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_STYLE_SCHEME_ROW)) #define TEPL_STYLE_SCHEME_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_STYLE_SCHEME_ROW, TeplStyleSchemeRowClass)) typedef struct _TeplStyleSchemeRow TeplStyleSchemeRow; typedef struct _TeplStyleSchemeRowClass TeplStyleSchemeRowClass; typedef struct _TeplStyleSchemeRowPrivate TeplStyleSchemeRowPrivate; struct _TeplStyleSchemeRow { GtkListBoxRow parent; TeplStyleSchemeRowPrivate *priv; }; struct _TeplStyleSchemeRowClass { GtkListBoxRowClass parent_class; }; G_GNUC_INTERNAL GType _tepl_style_scheme_row_get_type (void); G_GNUC_INTERNAL TeplStyleSchemeRow * _tepl_style_scheme_row_new (GtkSourceStyleScheme *style_scheme, gboolean for_dark_theme_variant); G_GNUC_INTERNAL GtkSourceStyleScheme * _tepl_style_scheme_row_get_style_scheme (TeplStyleSchemeRow *row); G_END_DECLS #endif /* TEPL_STYLE_SCHEME_ROW_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-group.c000066400000000000000000000161611526404732400261730ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-tab-group.h" /** * SECTION:tab-group * @Short_description: Interface for a group of #TeplTab's * @Title: TeplTabGroup * * The tepl_tab_group_get_tabs() function permits to get the list of #TeplTab's. * The tepl_tab_group_get_active_tab() function permits to get the #TeplTab * currently shown in the #TeplTabGroup. * * #TeplTabGroup also contains convenience functions to get #TeplView's and * #TeplBuffer's instead of #TeplTab's. */ G_DEFINE_INTERFACE (TeplTabGroup, tepl_tab_group, G_TYPE_OBJECT) static GList * tepl_tab_group_get_tabs_default (TeplTabGroup *tab_group) { return NULL; } static TeplTab * tepl_tab_group_get_active_tab_default (TeplTabGroup *tab_group) { return NULL; } static void tepl_tab_group_set_active_tab_default (TeplTabGroup *tab_group, TeplTab *tab) { } static void tepl_tab_group_append_tab_vfunc_default (TeplTabGroup *tab_group, TeplTab *tab) { g_warning ("Appending a TeplTab to this TeplTabGroup is not supported. " "Use for example TeplNotebook."); } static void tepl_tab_group_default_init (TeplTabGroupInterface *interface) { interface->get_tabs = tepl_tab_group_get_tabs_default; interface->get_active_tab = tepl_tab_group_get_active_tab_default; interface->set_active_tab = tepl_tab_group_set_active_tab_default; interface->append_tab_vfunc = tepl_tab_group_append_tab_vfunc_default; /** * TeplTabGroup:active-tab: * * The #TeplTab currently shown. * * Since: 3.0 */ g_object_interface_install_property (interface, g_param_spec_object ("active-tab", "Active Tab", "", TEPL_TYPE_TAB, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * TeplTabGroup:active-view: * * The #TeplView of the active tab. * * Since: 3.0 */ g_object_interface_install_property (interface, g_param_spec_object ("active-view", "Active View", "", TEPL_TYPE_VIEW, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** * TeplTabGroup:active-buffer: * * The #TeplBuffer of the active tab. * * Since: 3.0 */ g_object_interface_install_property (interface, g_param_spec_object ("active-buffer", "Active Buffer", "", TEPL_TYPE_BUFFER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); } /** * tepl_tab_group_get_tabs: * @tab_group: a #TeplTabGroup. * * Gets the list of #TeplTab's contained in @tab_group. * * If @tab_group contains non-#TeplTab children, those will not be present in the * returned list. In other words, it is not guaranteed that * the index of a #TeplTab in the returned #GList has the same child index in * the @tab_group container. * * Returns: (transfer container) (element-type TeplTab): the list of all the * #TeplTab's contained in @tab_group. * Since: 3.0 */ GList * tepl_tab_group_get_tabs (TeplTabGroup *tab_group) { g_return_val_if_fail (TEPL_IS_TAB_GROUP (tab_group), NULL); return TEPL_TAB_GROUP_GET_INTERFACE (tab_group)->get_tabs (tab_group); } /** * tepl_tab_group_get_views: * @tab_group: a #TeplTabGroup. * * Convenience function. * * Returns: (transfer container) (element-type TeplView): like * tepl_tab_group_get_tabs(), but returns #TeplView's. * Since: 3.0 */ GList * tepl_tab_group_get_views (TeplTabGroup *tab_group) { GList *tabs; GList *views = NULL; GList *l; g_return_val_if_fail (TEPL_IS_TAB_GROUP (tab_group), NULL); tabs = tepl_tab_group_get_tabs (tab_group); for (l = tabs; l != NULL; l = l->next) { TeplTab *cur_tab = l->data; views = g_list_prepend (views, tepl_tab_get_view (cur_tab)); } views = g_list_reverse (views); g_list_free (tabs); return views; } /** * tepl_tab_group_get_buffers: * @tab_group: a #TeplTabGroup. * * Convenience function. * * Returns: (transfer container) (element-type TeplBuffer): like * tepl_tab_group_get_tabs(), but returns #TeplBuffer's. * Since: 3.0 */ GList * tepl_tab_group_get_buffers (TeplTabGroup *tab_group) { GList *tabs; GList *buffers = NULL; GList *l; g_return_val_if_fail (TEPL_IS_TAB_GROUP (tab_group), NULL); tabs = tepl_tab_group_get_tabs (tab_group); for (l = tabs; l != NULL; l = l->next) { TeplTab *cur_tab = l->data; buffers = g_list_prepend (buffers, tepl_tab_get_buffer (cur_tab)); } buffers = g_list_reverse (buffers); g_list_free (tabs); return buffers; } /** * tepl_tab_group_get_active_tab: * @tab_group: a #TeplTabGroup. * * Returns: (transfer none) (nullable): the #TeplTab currently shown in * @tab_group. * Since: 3.0 */ TeplTab * tepl_tab_group_get_active_tab (TeplTabGroup *tab_group) { g_return_val_if_fail (TEPL_IS_TAB_GROUP (tab_group), NULL); return TEPL_TAB_GROUP_GET_INTERFACE (tab_group)->get_active_tab (tab_group); } /** * tepl_tab_group_set_active_tab: * @tab_group: a #TeplTabGroup. * @tab: a #TeplTab part of @tab_group. * * Sets the #TeplTabGroup:active-tab. @tab must be part of @tab_group. * * Since: 3.0 */ void tepl_tab_group_set_active_tab (TeplTabGroup *tab_group, TeplTab *tab) { GList *all_tabs; gboolean tab_in_tab_group; g_return_if_fail (TEPL_IS_TAB_GROUP (tab_group)); g_return_if_fail (TEPL_IS_TAB (tab)); all_tabs = tepl_tab_group_get_tabs (tab_group); tab_in_tab_group = g_list_find (all_tabs, tab) != NULL; g_list_free (all_tabs); g_return_if_fail (tab_in_tab_group); TEPL_TAB_GROUP_GET_INTERFACE (tab_group)->set_active_tab (tab_group, tab); } /** * tepl_tab_group_get_active_view: * @tab_group: a #TeplTabGroup. * * Convenience function. * * Returns: (transfer none) (nullable): the #TeplView of the active tab. * Since: 3.0 */ TeplView * tepl_tab_group_get_active_view (TeplTabGroup *tab_group) { TeplTab *active_tab; g_return_val_if_fail (TEPL_IS_TAB_GROUP (tab_group), NULL); active_tab = tepl_tab_group_get_active_tab (tab_group); return active_tab != NULL ? tepl_tab_get_view (active_tab) : NULL; } /** * tepl_tab_group_get_active_buffer: * @tab_group: a #TeplTabGroup. * * Convenience function. * * Returns: (transfer none) (nullable): the #TeplBuffer of the active tab. * Since: 3.0 */ TeplBuffer * tepl_tab_group_get_active_buffer (TeplTabGroup *tab_group) { TeplTab *active_tab; g_return_val_if_fail (TEPL_IS_TAB_GROUP (tab_group), NULL); active_tab = tepl_tab_group_get_active_tab (tab_group); return active_tab != NULL ? tepl_tab_get_buffer (active_tab) : NULL; } /** * tepl_tab_group_append_tab: * @tab_group: a #TeplTabGroup. * @tab: a #TeplTab. * @jump_to: whether to set @tab as the active tab after appending it. * * Appends @tab to @tab_group. * * Since: 3.0 */ void tepl_tab_group_append_tab (TeplTabGroup *tab_group, TeplTab *tab, gboolean jump_to) { g_return_if_fail (TEPL_IS_TAB_GROUP (tab_group)); g_return_if_fail (TEPL_IS_TAB (tab)); TEPL_TAB_GROUP_GET_INTERFACE (tab_group)->append_tab_vfunc (tab_group, tab); if (jump_to) { TeplView *view; tepl_tab_group_set_active_tab (tab_group, tab); view = tepl_tab_get_view (tab); gtk_widget_grab_focus (GTK_WIDGET (view)); } } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-group.h000066400000000000000000000061501526404732400261750ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_TAB_GROUP_H #define TEPL_TAB_GROUP_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include #include #include G_BEGIN_DECLS #define TEPL_TYPE_TAB_GROUP (tepl_tab_group_get_type ()) #define TEPL_TAB_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_TAB_GROUP, TeplTabGroup)) #define TEPL_IS_TAB_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_TAB_GROUP)) #define TEPL_TAB_GROUP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEPL_TYPE_TAB_GROUP, TeplTabGroupInterface)) typedef struct _TeplTabGroup TeplTabGroup; typedef struct _TeplTabGroupInterface TeplTabGroupInterface; /** * TeplTabGroupInterface: * @parent_interface: The parent interface. * @get_tabs: Virtual function pointer for tepl_tab_group_get_tabs(). By default, * %NULL is returned. When implementing this vfunc, #GList nodes must be * created only for #TeplTab children; if the #TeplTabGroup contains a * non-#TeplTab child, it must be skipped. See the documentation of * tepl_tab_group_get_tabs(). * @get_active_tab: Virtual function pointer for tepl_tab_group_get_active_tab(). * By default, %NULL is returned. * @set_active_tab: Virtual function pointer for * tepl_tab_group_set_active_tab(). Does nothing by default. * @append_tab_vfunc: Virtual function pointer for tepl_tab_group_append_tab(), * without the @jump_to parameter. The default implementation prints a warning * about the operation not being supported. * * The virtual function table for #TeplTabGroup. When implementing one of the * vfunc, you can assume that the pre-conditions are already checked (the * parameters are valid). * * Since: 3.0 */ struct _TeplTabGroupInterface { GTypeInterface parent_interface; GList * (*get_tabs) (TeplTabGroup *tab_group); TeplTab * (*get_active_tab) (TeplTabGroup *tab_group); void (*set_active_tab) (TeplTabGroup *tab_group, TeplTab *tab); void (*append_tab_vfunc) (TeplTabGroup *tab_group, TeplTab *tab); }; G_MODULE_EXPORT GType tepl_tab_group_get_type (void); G_MODULE_EXPORT GList * tepl_tab_group_get_tabs (TeplTabGroup *tab_group); G_MODULE_EXPORT GList * tepl_tab_group_get_views (TeplTabGroup *tab_group); G_MODULE_EXPORT GList * tepl_tab_group_get_buffers (TeplTabGroup *tab_group); G_MODULE_EXPORT TeplTab * tepl_tab_group_get_active_tab (TeplTabGroup *tab_group); G_MODULE_EXPORT void tepl_tab_group_set_active_tab (TeplTabGroup *tab_group, TeplTab *tab); G_MODULE_EXPORT TeplView * tepl_tab_group_get_active_view (TeplTabGroup *tab_group); G_MODULE_EXPORT TeplBuffer * tepl_tab_group_get_active_buffer (TeplTabGroup *tab_group); G_MODULE_EXPORT void tepl_tab_group_append_tab (TeplTabGroup *tab_group, TeplTab *tab, gboolean jump_to); G_END_DECLS #endif /* TEPL_TAB_GROUP_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-label.c000066400000000000000000000211051526404732400261100ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-tab-label.h" #include #include "tepl-buffer.h" #include "tepl-file.h" #include "tepl-signal-group.h" #include "tepl-utils.h" /** * SECTION:tab-label * @Short_description: A #TeplTab label, to use with #GtkNotebook * @Title: TeplTabLabel * * #TeplTabLabel is the label/title of a #TeplTab, suitable for #GtkNotebook. * * A #TeplTabLabel contains: * - a #GtkLabel with the #TeplBuffer:tepl-short-title. * - a close button, when clicked the #TeplTab #TeplTab::close-request signal is * emitted. * - a customizable tooltip, by default it shows the full #TeplFile:location. */ struct _TeplTabLabelPrivate { /* Weak ref */ TeplTab *tab; TeplSignalGroup *buffer_signal_group; TeplSignalGroup *file_signal_group; GtkLabel *label; }; enum { PROP_0, PROP_TAB, N_PROPERTIES }; static GParamSpec *properties[N_PROPERTIES]; #define MAX_LABEL_CHARS_LENGTH (42) G_DEFINE_TYPE_WITH_PRIVATE (TeplTabLabel, tepl_tab_label, GTK_TYPE_BOX) static void update_label (TeplTabLabel *tab_label) { TeplBuffer *buffer; gchar *short_title; gchar *truncated_short_title; if (tab_label->priv->tab == NULL) { return; } buffer = tepl_tab_get_buffer (tab_label->priv->tab); short_title = tepl_buffer_get_short_title (buffer); /* A GtkNotebook tab label doesn't support well an ellipsizing GtkLabel. * So, ellipsize ourself. */ truncated_short_title = tepl_utils_str_middle_truncate (short_title, MAX_LABEL_CHARS_LENGTH); gtk_label_set_text (tab_label->priv->label, truncated_short_title); g_free (truncated_short_title); g_free (short_title); } static void buffer_short_title_notify_cb (TeplBuffer *buffer, GParamSpec *pspec, TeplTabLabel *tab_label) { update_label (tab_label); } static void file_location_notify_cb (TeplFile *file, GParamSpec *pspec, TeplTabLabel *tab_label) { tepl_tab_label_update_tooltip (tab_label); } static void buffer_changed (TeplTabLabel *tab_label) { TeplBuffer *buffer; TeplFile *file; tepl_signal_group_clear (&tab_label->priv->buffer_signal_group); tepl_signal_group_clear (&tab_label->priv->file_signal_group); if (tab_label->priv->tab == NULL) { return; } /* Buffer */ buffer = tepl_tab_get_buffer (tab_label->priv->tab); tab_label->priv->buffer_signal_group = tepl_signal_group_new (G_OBJECT (buffer)); tepl_signal_group_add (tab_label->priv->buffer_signal_group, g_signal_connect (buffer, "notify::tepl-short-title", G_CALLBACK (buffer_short_title_notify_cb), tab_label)); update_label (tab_label); /* File */ file = tepl_buffer_get_file (buffer); tab_label->priv->file_signal_group = tepl_signal_group_new (G_OBJECT (file)); tepl_signal_group_add (tab_label->priv->file_signal_group, g_signal_connect (file, "notify::location", G_CALLBACK (file_location_notify_cb), tab_label)); tepl_tab_label_update_tooltip (tab_label); } static void buffer_notify_cb (GtkTextView *view, GParamSpec *pspec, TeplTabLabel *tab_label) { buffer_changed (tab_label); } static void set_tab (TeplTabLabel *tab_label, TeplTab *tab) { TeplView *view; if (tab == NULL) { return; } g_return_if_fail (TEPL_IS_TAB (tab)); g_assert (tab_label->priv->tab == NULL); g_set_weak_pointer (&tab_label->priv->tab, tab); view = tepl_tab_get_view (tab); g_signal_connect_object (view, "notify::buffer", G_CALLBACK (buffer_notify_cb), tab_label, 0); buffer_changed (tab_label); } static void tepl_tab_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplTabLabel *tab_label = TEPL_TAB_LABEL (object); switch (prop_id) { case PROP_TAB: g_value_set_object (value, tepl_tab_label_get_tab (tab_label)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_tab_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplTabLabel *tab_label = TEPL_TAB_LABEL (object); switch (prop_id) { case PROP_TAB: set_tab (tab_label, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_tab_label_dispose (GObject *object) { TeplTabLabel *tab_label = TEPL_TAB_LABEL (object); g_clear_weak_pointer (&tab_label->priv->tab); tepl_signal_group_clear (&tab_label->priv->buffer_signal_group); tepl_signal_group_clear (&tab_label->priv->file_signal_group); G_OBJECT_CLASS (tepl_tab_label_parent_class)->dispose (object); } static gchar * tepl_tab_label_get_tooltip_markup_default (TeplTabLabel *tab_label) { TeplBuffer *buffer; TeplFile *file; GFile *location; gchar *parse_name; gchar *parse_name_with_tilde; gchar *tooltip_markup; if (tab_label->priv->tab == NULL) { return NULL; } buffer = tepl_tab_get_buffer (tab_label->priv->tab); file = tepl_buffer_get_file (buffer); location = tepl_file_get_location (file); if (location == NULL) { return NULL; } parse_name = g_file_get_parse_name (location); parse_name_with_tilde = tepl_utils_replace_home_dir_with_tilde (parse_name); tooltip_markup = g_markup_printf_escaped ("%s %s", /* Translators: location of a file. */ _("Location:"), parse_name_with_tilde); g_free (parse_name_with_tilde); g_free (parse_name); return tooltip_markup; } static void tepl_tab_label_class_init (TeplTabLabelClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_tab_label_get_property; object_class->set_property = tepl_tab_label_set_property; object_class->dispose = tepl_tab_label_dispose; klass->get_tooltip_markup = tepl_tab_label_get_tooltip_markup_default; /** * TeplTabLabel:tab: * * The associated #TeplTab. #TeplTabLabel has a weak reference to the * #TeplTab. * * Since: 3.0 */ properties[PROP_TAB] = g_param_spec_object ("tab", "tab", "", TEPL_TYPE_TAB, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); } static void close_button_clicked_cb (GtkButton *close_button, TeplTabLabel *tab_label) { if (tab_label->priv->tab != NULL) { g_signal_emit_by_name (tab_label->priv->tab, "close-request"); } } static void tepl_tab_label_init (TeplTabLabel *tab_label) { GtkWidget *close_button; tab_label->priv = tepl_tab_label_get_instance_private (tab_label); /* Label */ tab_label->priv->label = GTK_LABEL (gtk_label_new (NULL)); gtk_widget_set_vexpand (GTK_WIDGET (tab_label->priv->label), TRUE); gtk_widget_show (GTK_WIDGET (tab_label->priv->label)); gtk_box_set_center_widget (GTK_BOX (tab_label), GTK_WIDGET (tab_label->priv->label)); /* Close button */ close_button = tepl_utils_create_close_button (); gtk_widget_set_tooltip_text (close_button, _("Close file")); g_signal_connect (close_button, "clicked", G_CALLBACK (close_button_clicked_cb), tab_label); gtk_widget_show (close_button); gtk_box_pack_end (GTK_BOX (tab_label), close_button, FALSE, FALSE, 0); } /** * tepl_tab_label_new: * @tab: a #TeplTab. * * Returns: (transfer floating): a new #TeplTabLabel. * Since: 3.0 */ GtkWidget * tepl_tab_label_new (TeplTab *tab) { g_return_val_if_fail (TEPL_IS_TAB (tab), NULL); return g_object_new (TEPL_TYPE_TAB_LABEL, "tab", tab, NULL); } /** * tepl_tab_label_get_tab: * @tab_label: a #TeplTabLabel. * * Returns: (transfer none) (nullable): the #TeplTabLabel:tab. * Since: 3.0 */ TeplTab * tepl_tab_label_get_tab (TeplTabLabel *tab_label) { g_return_val_if_fail (TEPL_IS_TAB_LABEL (tab_label), NULL); return tab_label->priv->tab; } /** * tepl_tab_label_update_tooltip: * @tab_label: a #TeplTabLabel. * * Asks #TeplTabLabel to update its tooltip. The ::get_tooltip_markup virtual * function is called and the result is set with * gtk_widget_set_tooltip_markup(). * * Since: 3.0 */ void tepl_tab_label_update_tooltip (TeplTabLabel *tab_label) { gchar *tooltip_markup; g_return_if_fail (TEPL_IS_TAB_LABEL (tab_label)); tooltip_markup = TEPL_TAB_LABEL_GET_CLASS (tab_label)->get_tooltip_markup (tab_label); gtk_widget_set_tooltip_markup (GTK_WIDGET (tab_label), tooltip_markup); g_free (tooltip_markup); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-label.h000066400000000000000000000041721526404732400261220ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_TAB_LABEL_H #define TEPL_TAB_LABEL_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include G_BEGIN_DECLS #define TEPL_TYPE_TAB_LABEL (tepl_tab_label_get_type ()) #define TEPL_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_TAB_LABEL, TeplTabLabel)) #define TEPL_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_TAB_LABEL, TeplTabLabelClass)) #define TEPL_IS_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_TAB_LABEL)) #define TEPL_IS_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_TAB_LABEL)) #define TEPL_TAB_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_TAB_LABEL, TeplTabLabelClass)) typedef struct _TeplTabLabel TeplTabLabel; typedef struct _TeplTabLabelClass TeplTabLabelClass; typedef struct _TeplTabLabelPrivate TeplTabLabelPrivate; struct _TeplTabLabel { GtkBox parent; TeplTabLabelPrivate *priv; }; /** * TeplTabLabelClass: * @parent_class: The parent class. * @get_tooltip_markup: Virtual function pointer to create the tooltip markup * string. %NULL must be returned if no tooltip is wanted. The result is * intended to be used as an argument to gtk_widget_set_tooltip_markup(). The * default implementation returns the full #TeplFile:location if non-%NULL, or * %NULL otherwise. The return value must be freed with g_free() when no * longer needed. */ struct _TeplTabLabelClass { GtkBoxClass parent_class; gchar * (* get_tooltip_markup) (TeplTabLabel *tab_label); /*< private >*/ gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_tab_label_get_type (void); G_MODULE_EXPORT GtkWidget * tepl_tab_label_new (TeplTab *tab); G_MODULE_EXPORT TeplTab * tepl_tab_label_get_tab (TeplTabLabel *tab_label); G_MODULE_EXPORT void tepl_tab_label_update_tooltip (TeplTabLabel *tab_label); G_END_DECLS #endif /* TEPL_TAB_LABEL_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-loading.c000066400000000000000000000046221526404732400264530ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-tab-loading.h" #include #include "tepl-file-loader.h" #include "tepl-info-bar.h" static void load_file_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplFileLoader *loader = TEPL_FILE_LOADER (source_object); TeplTab *tab = TEPL_TAB (user_data); GError *error = NULL; if (tepl_file_loader_load_finish (loader, result, &error)) { TeplBuffer *buffer; TeplFile *file; buffer = tepl_tab_get_buffer (tab); file = tepl_buffer_get_file (buffer); tepl_file_add_uri_to_recent_manager (file); } if (error != NULL && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { TeplInfoBar *info_bar; info_bar = tepl_info_bar_new_simple (GTK_MESSAGE_ERROR, _("Error when loading the file."), error->message); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); } g_clear_error (&error); g_object_unref (loader); g_object_unref (tab); } /** * tepl_tab_load_file: * @tab: a #TeplTab. * @location: a #GFile. * * Unconditionally loads a file in @tab, regardless if there are unsaved changes * in the #GtkTextBuffer. The previous buffer content is lost. * * This function is asynchronous, there is no way to know when the file loading * is finished. * * Since: 4.0 */ void tepl_tab_load_file (TeplTab *tab, GFile *location) { TeplBuffer *buffer; TeplFile *file; TeplFileLoader *loader; GCancellable *cancellable; g_return_if_fail (TEPL_IS_TAB (tab)); g_return_if_fail (G_IS_FILE (location)); buffer = tepl_tab_get_buffer (tab); file = tepl_buffer_get_file (buffer); tepl_file_set_location (file, location); loader = tepl_file_loader_new (buffer, file); cancellable = g_cancellable_new (); /* If there is a request to destroy the tab, it's pointless to continue * loading the file. So, cancel the operation when the tab is destroyed, * to free up resources for other operations. */ g_signal_connect_object (tab, "destroy", G_CALLBACK (g_cancellable_cancel), cancellable, G_CONNECT_SWAPPED); tepl_file_loader_load_async (loader, G_PRIORITY_DEFAULT, cancellable, load_file_cb, g_object_ref (tab)); g_object_unref (cancellable); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-loading.h000066400000000000000000000007251526404732400264600ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_TAB_LOADING_H #define TEPL_TAB_LOADING_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT void tepl_tab_load_file (TeplTab *tab, GFile *location); G_END_DECLS #endif /* TEPL_TAB_LOADING_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-saving.c000066400000000000000000000205211526404732400263210ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-tab-saving.h" #include #include "tepl-file.h" #include "tepl-file-saver.h" #include "tepl-info-bar.h" #include "tepl-utils.h" /* The functions in this file permits to run a TeplFileSaver, shows * TeplInfoBar's, until the operation is successful or if there is an * unrecoverable error. * * If this becomes a class, a good name would be TeplTabSaver. */ static void launch_saver_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplFileSaver *saver = TEPL_FILE_SAVER (source_object); GTask *task = G_TASK (user_data); TeplTab *tab; GApplication *app; GError *error = NULL; gboolean success; tab = g_task_get_source_object (task); success = tepl_file_saver_save_finish (saver, result, &error); if (success) { TeplFile *file; file = tepl_file_saver_get_file (saver); tepl_file_add_uri_to_recent_manager (file); } if (error != NULL) { TeplInfoBar *info_bar; info_bar = tepl_info_bar_new_simple (GTK_MESSAGE_ERROR, _("Error when saving the file."), error->message); tepl_info_bar_setup_close_button (info_bar); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); g_clear_error (&error); } app = g_application_get_default (); g_application_unmark_busy (app); g_application_release (app); g_task_return_boolean (task, success); g_object_unref (task); } static void launch_saver (GTask *task) { TeplFileSaver *saver; GApplication *app; saver = g_task_get_task_data (task); app = g_application_get_default (); g_application_hold (app); g_application_mark_busy (app); tepl_file_saver_save_async (saver, G_PRIORITY_DEFAULT, NULL, launch_saver_cb, task); } static void launch_saver_async (TeplTab *tab, TeplFileSaver *saver, GAsyncReadyCallback callback, gpointer user_data) { GTask *task; g_return_if_fail (TEPL_IS_TAB (tab)); g_return_if_fail (TEPL_IS_FILE_SAVER (saver)); task = g_task_new (tab, NULL, callback, user_data); g_task_set_task_data (task, g_object_ref (saver), g_object_unref); launch_saver (task); } static gboolean launch_saver_finish (TeplTab *tab, GAsyncResult *result) { g_return_val_if_fail (TEPL_IS_TAB (tab), FALSE); g_return_val_if_fail (g_task_is_valid (result, tab), FALSE); return g_task_propagate_boolean (G_TASK (result), NULL); } /** * tepl_tab_save_async: * @tab: a #TeplTab. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is * satisfied. * @user_data: user data to pass to @callback. * * Saves asynchronously the content of the @tab. The #TeplFile:location must not * be %NULL. * * See the #GAsyncResult documentation to know how to use this function. * * Since: 4.0 */ void tepl_tab_save_async (TeplTab *tab, GAsyncReadyCallback callback, gpointer user_data) { TeplBuffer *buffer; TeplFile *file; GFile *location; TeplFileSaver *saver; g_return_if_fail (TEPL_IS_TAB (tab)); buffer = tepl_tab_get_buffer (tab); file = tepl_buffer_get_file (buffer); location = tepl_file_get_location (file); g_return_if_fail (location != NULL); saver = tepl_file_saver_new (buffer, file); launch_saver_async (tab, saver, callback, user_data); g_object_unref (saver); } /** * tepl_tab_save_finish: * @tab: a #TeplTab. * @result: a #GAsyncResult. * * Finishes a tab saving started with tepl_tab_save_async(). * * Returns: whether the tab was saved successfully. * Since: 4.0 */ gboolean tepl_tab_save_finish (TeplTab *tab, GAsyncResult *result) { return launch_saver_finish (tab, result); } static void save_async_simple_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplTab *tab = TEPL_TAB (source_object); tepl_tab_save_finish (tab, result); g_object_unref (tab); } /** * tepl_tab_save_async_simple: * @tab: a #TeplTab. * * The same as tepl_tab_save_async(), but without callback. * * This function is useful when you don't need to know: * - when the operation is finished; * - and whether the operation ran successfully. * * Since: 4.0 */ void tepl_tab_save_async_simple (TeplTab *tab) { g_return_if_fail (TEPL_IS_TAB (tab)); g_object_ref (tab); tepl_tab_save_async (tab, save_async_simple_cb, NULL); } static void save_as_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplTab *tab = TEPL_TAB (source_object); GTask *task = G_TASK (user_data); gboolean ok; ok = launch_saver_finish (tab, result); g_task_return_boolean (task, ok); g_object_unref (task); } static void save_file_chooser_response_cb (GtkFileChooserDialog *file_chooser_dialog, gint response_id, GTask *task) { if (response_id == GTK_RESPONSE_ACCEPT) { TeplTab *tab; TeplBuffer *buffer; TeplFile *file; GFile *location; TeplFileSaver *saver; tab = g_task_get_source_object (task); buffer = tepl_tab_get_buffer (tab); file = tepl_buffer_get_file (buffer); location = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (file_chooser_dialog)); saver = tepl_file_saver_new_with_target (buffer, file, location); g_object_unref (location); launch_saver_async (tab, saver, save_as_cb, task); g_object_unref (saver); } else { g_task_return_boolean (task, FALSE); g_object_unref (task); } gtk_widget_destroy (GTK_WIDGET (file_chooser_dialog)); } /** * tepl_tab_save_as_async: * @tab: a #TeplTab. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is * satisfied. * @user_data: user data to pass to @callback. * * Shows a #GtkFileChooser to save the @tab to a different location, creates an * appropriate #TeplFileSaver and asynchronously runs it. * * See the #GAsyncResult documentation to know how to use this function. * * Since: 4.0 */ void tepl_tab_save_as_async (TeplTab *tab, GAsyncReadyCallback callback, gpointer user_data) { GTask *task; GtkWidget *file_chooser_dialog; GtkFileChooser *file_chooser; g_return_if_fail (TEPL_IS_TAB (tab)); task = g_task_new (tab, NULL, callback, user_data); file_chooser_dialog = gtk_file_chooser_dialog_new (_("Save File"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response (GTK_DIALOG (file_chooser_dialog), GTK_RESPONSE_ACCEPT); /* Prevent tab from being destroyed. */ gtk_window_set_modal (GTK_WINDOW (file_chooser_dialog), TRUE); _tepl_utils_associate_secondary_window (GTK_WINDOW (file_chooser_dialog), GTK_WIDGET (tab)); file_chooser = GTK_FILE_CHOOSER (file_chooser_dialog); gtk_file_chooser_set_do_overwrite_confirmation (file_chooser, TRUE); gtk_file_chooser_set_local_only (file_chooser, FALSE); g_signal_connect (file_chooser_dialog, "response", G_CALLBACK (save_file_chooser_response_cb), task); gtk_widget_show (file_chooser_dialog); } /** * tepl_tab_save_as_finish: * @tab: a #TeplTab. * @result: a #GAsyncResult. * * Finishes a tab saving started with tepl_tab_save_as_async(). * * Returns: whether the tab was saved successfully. * Since: 4.0 */ gboolean tepl_tab_save_as_finish (TeplTab *tab, GAsyncResult *result) { g_return_val_if_fail (TEPL_IS_TAB (tab), FALSE); g_return_val_if_fail (g_task_is_valid (result, tab), FALSE); return g_task_propagate_boolean (G_TASK (result), NULL); } static void save_as_async_simple_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplTab *tab = TEPL_TAB (source_object); tepl_tab_save_as_finish (tab, result); g_object_unref (tab); } /** * tepl_tab_save_as_async_simple: * @tab: a #TeplTab. * * The same as tepl_tab_save_as_async(), but without callback. * * This function is useful when you don't need to know: * - when the operation is finished; * - and whether the operation ran successfully. * * Since: 4.0 */ void tepl_tab_save_as_async_simple (TeplTab *tab) { g_return_if_fail (TEPL_IS_TAB (tab)); g_object_ref (tab); tepl_tab_save_as_async (tab, save_as_async_simple_cb, NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab-saving.h000066400000000000000000000020011526404732400263170ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_TAB_SAVING_H #define TEPL_TAB_SAVING_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT void tepl_tab_save_async (TeplTab *tab, GAsyncReadyCallback callback, gpointer user_data); G_MODULE_EXPORT gboolean tepl_tab_save_finish (TeplTab *tab, GAsyncResult *result); G_MODULE_EXPORT void tepl_tab_save_async_simple (TeplTab *tab); G_MODULE_EXPORT void tepl_tab_save_as_async (TeplTab *tab, GAsyncReadyCallback callback, gpointer user_data); G_MODULE_EXPORT gboolean tepl_tab_save_as_finish (TeplTab *tab, GAsyncResult *result); G_MODULE_EXPORT void tepl_tab_save_as_async_simple (TeplTab *tab); G_END_DECLS #endif /* TEPL_TAB_SAVING_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab.c000066400000000000000000000302001526404732400250270ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-tab.h" #include #include "tepl-close-confirm-dialog-single.h" #include "tepl-info-bar.h" #include "tepl-tab-group.h" /** * SECTION:tab * @Short_description: Contains a TeplView and GtkInfoBars * @Title: TeplTab * @See_also: #TeplInfoBar * * #TeplTab is meant to be the content of one tab in the text editor (if the * text editor has a Tabbed Document Interface). It is a #GtkGrid container that * contains the #TeplView and can contain one or several #GtkInfoBar's. Since it * is a #GtkGrid, an application can of course add any other widget to it. * * To create a new #GtkInfoBar, it is recommended to use #TeplInfoBar (but * #TeplTab doesn't enforce it). * * By default: * - #TeplTab has a vertical #GtkOrientation. * - The main child widget of #TeplTab is a #GtkScrolledWindow which contains * the #TeplView. * - #GtkInfoBar's are added on top of the #GtkScrolledWindow. * * The way that the #TeplView is packed into the #TeplTab is customizable with * the ::pack_view virtual function. Similarly, the way that #GtkInfoBar's are * added can be customized with ::pack_info_bar. * * # TeplTabGroup implementation * * #TeplTab implements the #TeplTabGroup interface, for a group of only one tab. * It is useful for text editors that open each file in a separate window, or * for applications that don't require to open more than one file. But the * tepl_tab_group_append_tab() operation is not supported, so some higher-level * features of Tepl don't work with #TeplTab as the #TeplTabGroup of the window. * This will maybe be improved in the future by creating automatically a new * window. */ struct _TeplTabPrivate { GtkScrolledWindow *scrolled_window; TeplView *view; TeplGotoLineBar *goto_line_bar; }; enum { PROP_0, PROP_VIEW, PROP_ACTIVE_TAB, PROP_ACTIVE_VIEW, PROP_ACTIVE_BUFFER, }; enum { SIGNAL_CLOSE_REQUEST, N_SIGNALS }; static guint signals[N_SIGNALS]; static void tepl_tab_group_interface_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (TeplTab, tepl_tab, GTK_TYPE_GRID, G_ADD_PRIVATE (TeplTab) G_IMPLEMENT_INTERFACE (TEPL_TYPE_TAB_GROUP, tepl_tab_group_interface_init)) static GtkScrolledWindow * create_scrolled_window (void) { GtkScrolledWindow *scrolled_window; scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL)); /* Disable overlay scrolling, it doesn't work well with GtkTextView. For * example to place the cursor with the mouse on the last character of a * line. */ gtk_scrolled_window_set_overlay_scrolling (scrolled_window, FALSE); g_object_set (scrolled_window, "expand", TRUE, NULL); gtk_widget_show (GTK_WIDGET (scrolled_window)); return scrolled_window; } static void tepl_tab_pack_view_default (TeplTab *tab, TeplView *view) { if (tab->priv->scrolled_window != NULL) { g_warning ("The TeplTab::pack_view virtual function can be called only once."); return; } tab->priv->scrolled_window = create_scrolled_window (); g_object_ref_sink (tab->priv->scrolled_window); gtk_container_add (GTK_CONTAINER (tab->priv->scrolled_window), GTK_WIDGET (view)); gtk_container_add (GTK_CONTAINER (tab), GTK_WIDGET (tab->priv->scrolled_window)); } static void tepl_tab_pack_info_bar_default (TeplTab *tab, GtkInfoBar *info_bar) { GtkWidget *sibling = NULL; if (tab->priv->scrolled_window != NULL) { sibling = GTK_WIDGET (tab->priv->scrolled_window); } if (sibling != NULL) { gtk_grid_insert_next_to (GTK_GRID (tab), sibling, GTK_POS_TOP); gtk_grid_attach_next_to (GTK_GRID (tab), GTK_WIDGET (info_bar), sibling, GTK_POS_TOP, 1, 1); } else { gtk_container_add (GTK_CONTAINER (tab), GTK_WIDGET (info_bar)); } } static void tepl_tab_pack_goto_line_bar_default (TeplTab *tab, TeplGotoLineBar *goto_line_bar) { gtk_container_add (GTK_CONTAINER (tab), GTK_WIDGET (goto_line_bar)); } static void close_confirm_dialog_single_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplTab *tab = TEPL_TAB (source_object); if (_tepl_close_confirm_dialog_single_finish (tab, result)) { gtk_widget_destroy (GTK_WIDGET (tab)); } } static void tepl_tab_close_request_default (TeplTab *tab) { _tepl_close_confirm_dialog_single_async (tab, close_confirm_dialog_single_cb, NULL); } static void buffer_notify_cb (GtkTextView *view, GParamSpec *pspec, TeplTab *tab) { g_object_notify (G_OBJECT (tab), "active-buffer"); } static void set_view (TeplTab *tab, TeplView *view) { if (view == NULL) { /* For tepl_tab_new(). */ view = TEPL_VIEW (tepl_view_new ()); gtk_widget_show (GTK_WIDGET (view)); } g_return_if_fail (TEPL_IS_VIEW (view)); g_assert (tab->priv->view == NULL); tab->priv->view = g_object_ref_sink (view); TEPL_TAB_GET_CLASS (tab)->pack_view (tab, view); g_signal_connect_object (view, "notify::buffer", G_CALLBACK (buffer_notify_cb), tab, 0); g_object_notify (G_OBJECT (tab), "view"); } static void tepl_tab_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { TeplTab *tab = TEPL_TAB (object); TeplTabGroup *tab_group = TEPL_TAB_GROUP (object); switch (prop_id) { case PROP_VIEW: g_value_set_object (value, tepl_tab_get_view (tab)); break; case PROP_ACTIVE_TAB: g_value_set_object (value, tepl_tab_group_get_active_tab (tab_group)); break; case PROP_ACTIVE_VIEW: g_value_set_object (value, tepl_tab_group_get_active_view (tab_group)); break; case PROP_ACTIVE_BUFFER: g_value_set_object (value, tepl_tab_group_get_active_buffer (tab_group)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_tab_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { TeplTab *tab = TEPL_TAB (object); TeplTabGroup *tab_group = TEPL_TAB_GROUP (object); switch (prop_id) { case PROP_VIEW: set_view (tab, g_value_get_object (value)); break; case PROP_ACTIVE_TAB: tepl_tab_group_set_active_tab (tab_group, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void tepl_tab_dispose (GObject *object) { TeplTab *tab = TEPL_TAB (object); g_clear_object (&tab->priv->scrolled_window); g_clear_object (&tab->priv->view); g_clear_object (&tab->priv->goto_line_bar); G_OBJECT_CLASS (tepl_tab_parent_class)->dispose (object); } static void tepl_tab_class_init (TeplTabClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->get_property = tepl_tab_get_property; object_class->set_property = tepl_tab_set_property; object_class->dispose = tepl_tab_dispose; klass->pack_view = tepl_tab_pack_view_default; klass->pack_info_bar = tepl_tab_pack_info_bar_default; klass->pack_goto_line_bar = tepl_tab_pack_goto_line_bar_default; klass->close_request = tepl_tab_close_request_default; /** * TeplTab:view: * * The #TeplView contained in the tab. When this property is set, the * ::pack_view virtual function is called. * * Since: 3.0 */ g_object_class_install_property (object_class, PROP_VIEW, g_param_spec_object ("view", "View", "", TEPL_TYPE_VIEW, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_override_property (object_class, PROP_ACTIVE_TAB, "active-tab"); g_object_class_override_property (object_class, PROP_ACTIVE_VIEW, "active-view"); g_object_class_override_property (object_class, PROP_ACTIVE_BUFFER, "active-buffer"); /** * TeplTab::close-request: * @tab: the #TeplTab emitting the signal. * * The ::close-request signal is emitted when there is a request to * close the #TeplTab, for example if the user clicks on a close button. * * The default object method handler does the following: * - If the buffer is not modified (according to * gtk_text_buffer_get_modified()), close the tab. * - Else, show a message dialog to propose to save the file before * closing. * * To override the default object method handler, either override the * virtual function in a #TeplTab subclass or connect to the signal and * call g_signal_stop_emission_by_name(). * * Since: 3.0 */ signals[SIGNAL_CLOSE_REQUEST] = g_signal_new ("close-request", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (TeplTabClass, close_request), NULL, NULL, NULL, G_TYPE_NONE, 0); } static GList * tepl_tab_get_tabs (TeplTabGroup *tab_group) { return g_list_append (NULL, TEPL_TAB (tab_group)); } static TeplTab * tepl_tab_get_active_tab (TeplTabGroup *tab_group) { return TEPL_TAB (tab_group); } static void tepl_tab_group_interface_init (gpointer g_iface, gpointer iface_data) { TeplTabGroupInterface *interface = g_iface; interface->get_tabs = tepl_tab_get_tabs; interface->get_active_tab = tepl_tab_get_active_tab; } static void tepl_tab_init (TeplTab *tab) { tab->priv = tepl_tab_get_instance_private (tab); gtk_orientable_set_orientation (GTK_ORIENTABLE (tab), GTK_ORIENTATION_VERTICAL); } /** * tepl_tab_new: * * Creates a new #TeplTab with a new #TeplView. The new #TeplView can be * retrieved afterwards with tepl_tab_get_view(). * * Returns: a new #TeplTab. * Since: 3.0 */ TeplTab * tepl_tab_new (void) { return g_object_new (TEPL_TYPE_TAB, NULL); } /** * tepl_tab_new_with_view: * @view: the #TeplView that will be contained in the tab. * * Returns: a new #TeplTab. * Since: 3.0 */ TeplTab * tepl_tab_new_with_view (TeplView *view) { g_return_val_if_fail (TEPL_IS_VIEW (view), NULL); return g_object_new (TEPL_TYPE_TAB, "view", view, NULL); } /** * tepl_tab_get_view: * @tab: a #TeplTab. * * Returns: (transfer none): the #TeplView contained in @tab. * Since: 3.0 */ TeplView * tepl_tab_get_view (TeplTab *tab) { g_return_val_if_fail (TEPL_IS_TAB (tab), NULL); return tab->priv->view; } /** * tepl_tab_get_buffer: * @tab: a #TeplTab. * * A convenience function that calls gtk_text_view_get_buffer() on the * #TeplTab:view associated with the @tab. * * Returns: (transfer none): the #TeplBuffer of the #TeplTab:view. * Since: 3.0 */ TeplBuffer * tepl_tab_get_buffer (TeplTab *tab) { g_return_val_if_fail (TEPL_IS_TAB (tab), NULL); if (tab->priv->view == NULL) { return NULL; } return TEPL_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (tab->priv->view))); } /** * tepl_tab_get_goto_line_bar: * @tab: a #TeplTab. * * Gets the #TeplGotoLineBar widget belonging to @tab. The #TeplGotoLineBar must * not be destroyed by the application, the purpose of this function is to * show/hide the widget. * * Returns: (transfer none): the #TeplGotoLineBar widget belonging to @tab. * Since: 5.0 */ TeplGotoLineBar * tepl_tab_get_goto_line_bar (TeplTab *tab) { g_return_val_if_fail (TEPL_IS_TAB (tab), NULL); if (tab->priv->goto_line_bar == NULL) { tab->priv->goto_line_bar = tepl_goto_line_bar_new (); g_object_ref_sink (tab->priv->goto_line_bar); /* The TeplGotoLineBar needs to be explicitly shown/hidden. */ gtk_widget_set_no_show_all (GTK_WIDGET (tab->priv->goto_line_bar), TRUE); tepl_goto_line_bar_set_view (tab->priv->goto_line_bar, tab->priv->view); TEPL_TAB_GET_CLASS (tab)->pack_goto_line_bar (tab, tab->priv->goto_line_bar); } return tab->priv->goto_line_bar; } /** * tepl_tab_add_info_bar: * @tab: a #TeplTab. * @info_bar: a #GtkInfoBar. * * Attaches @info_bar to @tab. * * This function calls the ::pack_info_bar virtual function. * * Since: 1.0 */ void tepl_tab_add_info_bar (TeplTab *tab, GtkInfoBar *info_bar) { g_return_if_fail (TEPL_IS_TAB (tab)); g_return_if_fail (GTK_IS_INFO_BAR (info_bar)); _tepl_info_bar_set_size_request (info_bar); TEPL_TAB_GET_CLASS (tab)->pack_info_bar (tab, info_bar); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-tab.h000066400000000000000000000054561526404732400250530ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_TAB_H #define TEPL_TAB_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include #include #include #include G_BEGIN_DECLS #define TEPL_TYPE_TAB (tepl_tab_get_type ()) #define TEPL_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_TAB, TeplTab)) #define TEPL_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_TAB, TeplTabClass)) #define TEPL_IS_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_TAB)) #define TEPL_IS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_TAB)) #define TEPL_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_TAB, TeplTabClass)) typedef struct _TeplTab TeplTab; typedef struct _TeplTabClass TeplTabClass; typedef struct _TeplTabPrivate TeplTabPrivate; struct _TeplTab { GtkGrid parent; TeplTabPrivate *priv; }; /** * TeplTabClass: * @parent_class: The parent class. * @pack_view: Virtual function pointer to add the #TeplView in the #TeplTab * container. Called only once at object construction time, when the * #TeplTab:view property is set. By default the #TeplView is added to a * #GtkScrolledWindow and the #GtkScrolledWindow is added to the #TeplTab with * gtk_container_add(). * @pack_info_bar: Virtual function pointer to add a #GtkInfoBar in the #TeplTab * container. By default the #GtkInfoBar is inserted just above the * #GtkScrolledWindow containing the #TeplView. * @pack_goto_line_bar: Virtual function pointer to add a #TeplGotoLineBar in * the #TeplTab container. By default the #TeplGotoLineBar is added at the * bottom. * @close_request: For the #TeplTab::close-request signal. */ struct _TeplTabClass { GtkGridClass parent_class; /* Vfuncs */ void (* pack_view) (TeplTab *tab, TeplView *view); void (* pack_info_bar) (TeplTab *tab, GtkInfoBar *info_bar); void (* pack_goto_line_bar) (TeplTab *tab, TeplGotoLineBar *goto_line_bar); /* Signals */ void (* close_request) (TeplTab *tab); /*< private >*/ gpointer padding[12]; }; G_MODULE_EXPORT GType tepl_tab_get_type (void); G_MODULE_EXPORT TeplTab * tepl_tab_new (void); G_MODULE_EXPORT TeplTab * tepl_tab_new_with_view (TeplView *view); G_MODULE_EXPORT TeplView * tepl_tab_get_view (TeplTab *tab); G_MODULE_EXPORT TeplBuffer * tepl_tab_get_buffer (TeplTab *tab); G_MODULE_EXPORT TeplGotoLineBar *tepl_tab_get_goto_line_bar (TeplTab *tab); G_MODULE_EXPORT void tepl_tab_add_info_bar (TeplTab *tab, GtkInfoBar *info_bar); G_END_DECLS #endif /* TEPL_TAB_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-utils.c000066400000000000000000001060651526404732400254360ustar00rootroot00000000000000/* From gedit-utils.c: * SPDX-FileCopyrightText: 1998, 1999 - Alex Roberts, Evan Lawrence * SPDX-FileCopyrightText: 2000, 2002 - Chema Celorio, Paolo Maggi * SPDX-FileCopyrightText: 2003-2005 - Paolo Maggi * * SPDX-FileCopyrightText: 2016-2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-utils.h" #include #include "tepl-application-window.h" #include "tepl-icu.h" #include "tepl-pango.h" /** * SECTION:utils * @Short_description: Utility functions * @Title: TeplUtils * * Utility functions. */ static gchar * str_truncate (const gchar *string, guint truncate_length, gboolean middle) { GString *truncated; guint length; guint n_chars; guint num_left_chars; guint right_offset; guint delimiter_length; const gchar *delimiter = "\342\200\246"; /* The character: … */ g_return_val_if_fail (string != NULL, NULL); length = strlen (string); g_return_val_if_fail (g_utf8_validate (string, length, NULL), NULL); /* It doesnt make sense to truncate strings to less than * the size of the delimiter plus 2 characters (one on each * side) */ delimiter_length = g_utf8_strlen (delimiter, -1); if (truncate_length < (delimiter_length + 2)) { return g_strdup (string); } n_chars = g_utf8_strlen (string, length); /* Make sure the string is not already small enough. */ if (n_chars <= truncate_length) { return g_strdup (string); } /* Find the 'middle' where the truncation will occur. */ if (middle) { num_left_chars = (truncate_length - delimiter_length) / 2; right_offset = n_chars - truncate_length + num_left_chars + delimiter_length; truncated = g_string_new_len (string, g_utf8_offset_to_pointer (string, num_left_chars) - string); g_string_append (truncated, delimiter); g_string_append (truncated, g_utf8_offset_to_pointer (string, right_offset)); } else { num_left_chars = truncate_length - delimiter_length; truncated = g_string_new_len (string, g_utf8_offset_to_pointer (string, num_left_chars) - string); g_string_append (truncated, delimiter); } return g_string_free (truncated, FALSE); } /** * tepl_utils_str_middle_truncate: * @str: a UTF-8 string. * @truncate_length: truncate the string at that length, in UTF-8 characters * (not bytes). * * If @str is longer than @truncate_length, then this function returns @str * truncated in the middle with a “…” character. Otherwise it just returns a * copy of @str. * * Returns: the truncated string. Free with g_free(). * Since: 4.4 */ gchar * tepl_utils_str_middle_truncate (const gchar *str, guint truncate_length) { return str_truncate (str, truncate_length, TRUE); } /** * tepl_utils_str_end_truncate: * @str: a UTF-8 string. * @truncate_length: truncate the string at that length, in UTF-8 characters * (not bytes). * * Like tepl_utils_str_middle_truncate() but the “…” character is at the end. * * Returns: the truncated string. Free with g_free(). * Since: 4.4 */ gchar * tepl_utils_str_end_truncate (const gchar *str, guint truncate_length) { return str_truncate (str, truncate_length, FALSE); } /** * tepl_utils_str_replace: * @string: a string * @search: the search string * @replacement: the replacement string * * Replaces all occurences of @search by @replacement. * * The function does only one pass, for example: * |[ * tepl_utils_str_replace ("aaaa", "aa", "a"); * ]| * returns "aa", not "a". * * Returns: A newly allocated string with the replacements. Free with g_free(). * Since: 4.4 */ gchar * tepl_utils_str_replace (const gchar *string, const gchar *search, const gchar *replacement) { gchar **chunks; gchar *ret; g_return_val_if_fail (string != NULL, NULL); g_return_val_if_fail (search != NULL, NULL); g_return_val_if_fail (replacement != NULL, NULL); chunks = g_strsplit (string, search, -1); if (chunks != NULL && chunks[0] != NULL) { ret = g_strjoinv (replacement, chunks); } else { ret = g_strdup (string); } g_strfreev (chunks); return ret; } /** * tepl_utils_markup_escape_text: * @src: a nul-terminated UTF-8 string. * * The same as g_markup_escape_text(), but with an implementation that fully * supports round-trip integrity. I.e. when #GMarkupParser or any other XML * parser will decode/unescape the string, the exact same string as @src will be * brought back. As long as @src is a valid UTF-8 string. * * The other difference with g_markup_escape_text() is that the @length * parameter is not present for tepl_utils_markup_escape_text(). * * # g_markup_escape_text() doesn't fully support round-trip integrity * * In fact, g_markup_escape_text() doesn't escape the tabstop, newline and * carriage return characters. And the #GMarkupParser correctly processes * whitespace and line endings according to the [XML rules for normalization of * line endings and attribute values](https://www.w3.org/TR/xml/#AVNormalize). * * For example `"\t"` (a tab) after a round-trip through g_markup_escape_text() * and #GMarkupParser becomes a simple space. * * Returns: (transfer full) (nullable): a newly allocated string with the * escaped text, or %NULL if @src is not a valid UTF-8 string. Free with * g_free() when no longer needed. * Since: 5.0 */ gchar * tepl_utils_markup_escape_text (const gchar *src) { UChar *src_uchars; UTransliterator *trans; UChar *dest_uchars = NULL; gchar *dest = NULL; src_uchars = _tepl_icu_strFromUTF8Simple (src); if (src_uchars == NULL) { return NULL; } trans = _tepl_icu_trans_open_xml_escape (); if (trans == NULL) { goto out; } dest_uchars = _tepl_icu_trans_transUCharsSimple (trans, src_uchars); if (dest_uchars == NULL) { goto out; } dest = _tepl_icu_strToUTF8Simple (dest_uchars); out: g_free (src_uchars); g_free (dest_uchars); if (trans != NULL) { utrans_close (trans); } return dest; } /* Useful for showing additional GtkLabels in a GtkStatusbar. * It uses spaces to have padding proportional to the font size. */ gchar * _tepl_utils_statusbar_add_padding_to_text (const gchar *text) { return g_strdup_printf (" %s ", text); } static gint get_extension_position (const gchar *filename) { const gchar *pos; gint length; if (filename == NULL) { return 0; } length = strlen (filename); pos = filename + length; g_assert (pos[0] == '\0'); while (TRUE) { pos = g_utf8_find_prev_char (filename, pos); if (pos == NULL || pos[0] == G_DIR_SEPARATOR) { break; } if (pos[0] == '.') { return pos - filename; } } return length; } /** * tepl_utils_get_file_extension: * @filename: a filename. * * Examples: * - "file.pdf" returns ".pdf". * - "file.PDF" returns ".pdf". * - "file.tar.gz" returns ".gz". * - "path/to/file.pdf" returns ".pdf". * - "file" (without an extension) returns "" (the empty string). * * Returns: the @filename's extension with the dot, in lowercase. Free with * g_free(). * Since: 4.4 */ gchar * tepl_utils_get_file_extension (const gchar *filename) { gint pos = get_extension_position (filename); return g_utf8_strdown (filename + pos, -1); } /** * tepl_utils_get_file_shortname: * @filename: a filename. * * Returns @filename without its extension. With the “extension” having the same * definition as in tepl_utils_get_file_extension(); in other words it returns * the other part of @filename. * * Returns: the @filename without its extension. Free with g_free(). * Since: 4.4 */ gchar * tepl_utils_get_file_shortname (const gchar *filename) { return g_strndup (filename, get_extension_position (filename)); } static gchar * get_home_dir_without_trailing_slash (const gchar *home_dir) { gchar *utf8_home_dir; gsize length; if (home_dir == NULL) { return NULL; } utf8_home_dir = g_filename_to_utf8 (home_dir, -1, NULL, NULL, NULL); if (utf8_home_dir == NULL) { return NULL; } length = strlen (utf8_home_dir); if (length == 0) { g_free (utf8_home_dir); return NULL; } if (utf8_home_dir[length - 1] == '/') { utf8_home_dir[length - 1] = '\0'; } return utf8_home_dir; } /* Like tepl_utils_replace_home_dir_with_tilde() but with an additional home_dir * parameter, for unit tests. */ gchar * _tepl_utils_replace_home_dir_with_tilde_with_param (const gchar *filename, const gchar *home_dir) { gchar *home_dir_without_trailing_slash; gchar *home_dir_with_trailing_slash; gchar *ret; g_return_val_if_fail (filename != NULL, NULL); home_dir_without_trailing_slash = get_home_dir_without_trailing_slash (home_dir); if (home_dir_without_trailing_slash == NULL) { return g_strdup (filename); } home_dir_with_trailing_slash = g_strdup_printf ("%s/", home_dir_without_trailing_slash); if (g_str_equal (filename, home_dir_without_trailing_slash) || g_str_equal (filename, home_dir_with_trailing_slash)) { ret = g_strdup ("~"); goto out; } if (g_str_has_prefix (filename, home_dir_with_trailing_slash)) { ret = g_strdup_printf ("~/%s", filename + strlen (home_dir_with_trailing_slash)); goto out; } ret = g_strdup (filename); out: g_free (home_dir_without_trailing_slash); g_free (home_dir_with_trailing_slash); return ret; } /** * tepl_utils_replace_home_dir_with_tilde: * @filename: the filename. * * Replaces the home directory with a tilde, if the home directory is present in * the @filename. * * Returns: the new filename. Free with g_free(). * Since: 4.4 */ gchar * tepl_utils_replace_home_dir_with_tilde (const gchar *filename) { return _tepl_utils_replace_home_dir_with_tilde_with_param (filename, g_get_home_dir ()); } static void null_ptr (gchar **ptr) { if (ptr != NULL) { *ptr = NULL; } } /** * tepl_utils_decode_uri: * @uri: the uri to decode * @scheme: (out) (optional): return value pointer for the uri's * scheme (e.g. http, sftp, ...), or %NULL * @user: (out) (optional): return value pointer for the uri user info, or %NULL * @host: (out) (optional): return value pointer for the uri host, or %NULL * @port: (out) (optional): return value pointer for the uri port, or %NULL * @path: (out) (optional): return value pointer for the uri path, or %NULL * * This function is deprecated, use the #GUri functions instead. * * Parse and break an uri apart in its individual components like the uri * scheme, user info, host, port and path. The return value pointer can be * %NULL to ignore certain parts of the uri. If the function returns %TRUE, then * all return value pointers should be freed using g_free(). * * Returns: %TRUE if the uri could be properly decoded, %FALSE otherwise. * Since: 5.0 */ gboolean tepl_utils_decode_uri (const gchar *uri, gchar **scheme, gchar **user, gchar **host, gchar **port, gchar **path) { /* Largely copied from glib/gio/gdummyfile.c: _g_decode_uri(). * TODO: it's now available in GLib with GUri, so deprecate/remove this * function. */ const char *p, *in, *hier_part_start, *hier_part_end; char *out; char c; /* From RFC 3986 Decodes: * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] */ p = uri; null_ptr (scheme); null_ptr (user); null_ptr (port); null_ptr (host); null_ptr (path); /* Decode scheme: * scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) */ if (!g_ascii_isalpha (*p)) return FALSE; while (1) { c = *p++; if (c == ':') break; if (!(g_ascii_isalnum(c) || c == '+' || c == '-' || c == '.')) { return FALSE; } } if (scheme) { *scheme = g_malloc (p - uri); out = *scheme; for (in = uri; in < p - 1; in++) { *out++ = g_ascii_tolower (*in); } *out = '\0'; } hier_part_start = p; hier_part_end = p + strlen (p); if (hier_part_start[0] == '/' && hier_part_start[1] == '/') { const char *authority_start, *authority_end; const char *userinfo_start, *userinfo_end; const char *host_start, *host_end; const char *port_start; authority_start = hier_part_start + 2; /* authority is always followed by / or nothing */ authority_end = memchr (authority_start, '/', hier_part_end - authority_start); if (authority_end == NULL) authority_end = hier_part_end; /* 3.2: * authority = [ userinfo "@" ] host [ ":" port ] */ userinfo_end = memchr (authority_start, '@', authority_end - authority_start); if (userinfo_end) { userinfo_start = authority_start; if (user) *user = g_uri_unescape_segment (userinfo_start, userinfo_end, NULL); if (user && *user == NULL) { if (scheme) g_free (*scheme); return FALSE; } host_start = userinfo_end + 1; } else { host_start = authority_start; } port_start = memchr (host_start, ':', authority_end - host_start); if (port_start) { host_end = port_start++; if (port) *port = g_strndup (port_start, authority_end - port_start); } else { host_end = authority_end; } if (host) *host = g_strndup (host_start, host_end - host_start); hier_part_start = authority_end; } if (path) *path = g_uri_unescape_segment (hier_part_start, hier_part_end, "/"); return TRUE; } /** * _tepl_utils_get_fallback_basename_for_display: * @location: a #GFile. * * If querying the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME fails, this function * can be used as a fallback. * * Returns: (transfer full): the @location's basename suitable for display. */ gchar * _tepl_utils_get_fallback_basename_for_display (GFile *location) { gchar *basename; gchar *parse_name; g_return_val_if_fail (G_IS_FILE (location), NULL); if (g_file_has_uri_scheme (location, "file")) { gchar *local_path; local_path = g_file_get_path (location); basename = g_filename_display_basename (local_path); g_free (local_path); return basename; } if (!g_file_has_parent (location, NULL)) { return g_file_get_parse_name (location); } parse_name = g_file_get_parse_name (location); basename = g_filename_display_basename (parse_name); g_free (parse_name); /* FIXME: maybe needed: * basename_unescaped = g_uri_unescape_string (basename, NULL); */ return basename; } /** * tepl_utils_create_parent_directories: * @file: a file * @cancellable: (nullable): optional #GCancellable object, %NULL to ignore. * @error: (out) (optional): a location to a %NULL #GError, or %NULL. * * Synchronously creates parent directories of @file, so that @file can be * saved. * * Returns: whether the directories are correctly created. %FALSE is returned on * error. * Since: 5.0 */ gboolean tepl_utils_create_parent_directories (GFile *file, GCancellable *cancellable, GError **error) { GFile *parent; GError *my_error = NULL; g_return_val_if_fail (G_IS_FILE (file), FALSE); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); parent = g_file_get_parent (file); if (parent == NULL) { return TRUE; } g_file_make_directory_with_parents (parent, cancellable, &my_error); g_clear_object (&parent); if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_EXISTS)) { g_error_free (my_error); return TRUE; } if (my_error != NULL) { g_propagate_error (error, my_error); return FALSE; } return TRUE; } /** * tepl_utils_file_query_exists_async: * @file: a #GFile. * @cancellable: a #GCancellable. * @callback: the callback to call when the operation is finished. * @user_data: the data to pass to the callback function. * * The asynchronous version of g_file_query_exists(). When the operation is * finished, @callback will be called. You can then call * tepl_utils_file_query_exists_finish() to get the result of the operation. * * Since: 5.0 */ void tepl_utils_file_query_exists_async (GFile *file, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_file_query_info_async (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, cancellable, callback, user_data); } /** * tepl_utils_file_query_exists_finish: * @file: a #GFile. * @result: a #GAsyncResult. * * Finishes the operation started with tepl_utils_file_query_exists_async(). * There is no output #GError parameter, so you should check if the operation * has been cancelled (in which case %FALSE will be returned). * * Returns: %TRUE if the file exists and the operation hasn't been cancelled, * %FALSE otherwise. * Since: 5.0 */ gboolean tepl_utils_file_query_exists_finish (GFile *file, GAsyncResult *result) { GFileInfo *info = g_file_query_info_finish (file, result, NULL); if (info != NULL) { g_object_unref (info); return TRUE; } return FALSE; } /** * tepl_utils_create_close_button: * * Returns: (transfer floating): a new close button (a #GtkButton). * Since: 5.0 */ GtkWidget * tepl_utils_create_close_button (void) { GtkWidget *close_button; GtkStyleContext *style_context; close_button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_BUTTON); gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE); gtk_widget_set_focus_on_click (close_button, FALSE); style_context = gtk_widget_get_style_context (close_button); gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_FLAT); return close_button; } /* For a secondary window (e.g. a GtkDialog): * - Set transient parent. * - Add it to the GtkWindowGroup. * Just by giving a widget inside the main window. */ void _tepl_utils_associate_secondary_window (GtkWindow *secondary_window, GtkWidget *main_window_widget) { GtkWindow *main_window; g_return_if_fail (GTK_IS_WINDOW (secondary_window)); g_return_if_fail (GTK_IS_WIDGET (main_window_widget)); /* get_toplevel() functions are a bit evil, normally it's a bad practice * when an object is aware of who contains it, i.e. it's fine that a * container knows what it contains (of course) but the reverse is not * true. * * But here it's just to setup correctly e.g. a GtkDialog, it's * something a bit specific to GTK. As long as this bad practice is * applied only in this case (setting the transient parent and adding * the secondary window to a GtkWindowGroup), it should be fine. It * would be more problematic to call other TeplApplicationWindow * functions. */ main_window = tepl_utils_get_toplevel_window (main_window_widget); if (main_window != NULL) { gtk_window_set_transient_for (secondary_window, main_window); } if (GTK_IS_APPLICATION_WINDOW (main_window) && tepl_application_window_is_main_window (GTK_APPLICATION_WINDOW (main_window))) { TeplApplicationWindow *tepl_window; GtkWindowGroup *window_group; tepl_window = tepl_application_window_get_from_gtk_application_window (GTK_APPLICATION_WINDOW (main_window)); window_group = tepl_application_window_get_window_group (tepl_window); gtk_window_group_add_window (window_group, secondary_window); } } /** * tepl_utils_show_warning_dialog: * @parent: (nullable): the #GtkWindow issuing the warning. * @format: format string, as with printf(). * @...: parameters to insert into the format string. * * Shows a #GtkDialog with the provided warning message. * * Since: 5.0 */ void tepl_utils_show_warning_dialog (GtkWindow *parent, const gchar *format, ...) { va_list args; gchar *str; GtkWidget *dialog; GtkWindowGroup *window_group = NULL; g_return_if_fail (format != NULL); if (parent != NULL) { window_group = gtk_window_get_group (parent); } va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); dialog = gtk_message_dialog_new_with_markup (parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", str); g_free (str); if (window_group != NULL) { gtk_window_group_add_window (window_group, GTK_WINDOW (dialog)); } gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (dialog); } static void list_box_clear_foreach_cb (GtkWidget *child, gpointer user_data) { gtk_widget_destroy (child); } /** * tepl_utils_list_box_clear: * @list_box: a #GtkListBox. * * Removes all rows of @list_box, to obtain an empty #GtkListBox. * * Since: 6.0 */ void tepl_utils_list_box_clear (GtkListBox *list_box) { g_return_if_fail (GTK_IS_LIST_BOX (list_box)); gtk_container_foreach (GTK_CONTAINER (list_box), list_box_clear_foreach_cb, NULL); } /** * tepl_utils_list_box_setup_scrolling: * @list_box: a #GtkListBox. * @scrolled_window: a #GtkScrolledWindow. * * Setup vertical scrolling between @list_box and @scrolled_window, to be able * to use tepl_utils_list_box_scroll_to_row() afterwards. * * This function is intended to be called only once per #GtkListBox, when * initializing the @list_box and @scrolled_window widgets. * * Since: 6.0 */ void tepl_utils_list_box_setup_scrolling (GtkListBox *list_box, GtkScrolledWindow *scrolled_window) { GtkAdjustment *vadjustment; g_return_if_fail (GTK_IS_LIST_BOX (list_box)); g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window)); vadjustment = gtk_scrolled_window_get_vadjustment (scrolled_window); gtk_container_set_focus_vadjustment (GTK_CONTAINER (list_box), vadjustment); } /** * tepl_utils_list_box_scroll_to_row: * @list_box: a #GtkListBox. * @row: a #GtkListBoxRow. * * Scrolls to a specific #GtkListBoxRow. * * Before using this function, tepl_utils_list_box_setup_scrolling() must have * been called. * * Since: 6.0 */ void tepl_utils_list_box_scroll_to_row (GtkListBox *list_box, GtkListBoxRow *row) { g_return_if_fail (GTK_IS_LIST_BOX (list_box)); g_return_if_fail (GTK_IS_LIST_BOX_ROW (row)); gtk_container_set_focus_child (GTK_CONTAINER (list_box), GTK_WIDGET (row)); } /** * tepl_utils_list_box_scroll_to_selected_row: * @list_box: a #GtkListBox. * * Calls tepl_utils_list_box_scroll_to_row() on the row returned by * gtk_list_box_get_selected_row(). This function assumes that there is either * zero or one selected row. * * Before using this function, tepl_utils_list_box_setup_scrolling() must have * been called. * * Since: 6.0 */ void tepl_utils_list_box_scroll_to_selected_row (GtkListBox *list_box) { GtkListBoxRow *selected_row; g_return_if_fail (GTK_IS_LIST_BOX (list_box)); selected_row = gtk_list_box_get_selected_row (list_box); if (selected_row != NULL) { tepl_utils_list_box_scroll_to_row (list_box, selected_row); } } /** * tepl_utils_list_box_get_row_at_index_with_filter: * @list_box: a #GtkListBox. * @index: the index of the row, starting at 0. The index is among the filtered * rows only. * @filter_func: (scope call): non-%NULL callback function. * @user_data: user data passed to @filter_func. * * This function has the same semantics as gtk_list_box_get_row_at_index(), but * it takes into account only the rows for which @filter_func returns %TRUE. * * As an example, if @index is 0, it returns the first #GtkListBoxRow for which * @filter_func returns %TRUE. * * Returns: (transfer none) (nullable): the child #GtkListBoxRow or %NULL. * Since: 6.0 */ GtkListBoxRow * tepl_utils_list_box_get_row_at_index_with_filter (GtkListBox *list_box, gint index, GtkListBoxFilterFunc filter_func, gpointer user_data) { GList *all_rows; GList *l; gint remaining_rows_to_find = index + 1; GtkListBoxRow *ret = NULL; g_return_val_if_fail (GTK_IS_LIST_BOX (list_box), NULL); g_return_val_if_fail (filter_func != NULL, NULL); if (index < 0) { return NULL; } all_rows = gtk_container_get_children (GTK_CONTAINER (list_box)); for (l = all_rows; l != NULL; l = l->next) { GtkListBoxRow *cur_row = GTK_LIST_BOX_ROW (l->data); if (filter_func (cur_row, user_data)) { remaining_rows_to_find--; if (remaining_rows_to_find == 0) { ret = cur_row; break; } } } g_list_free (all_rows); return ret; } /** * tepl_utils_list_box_get_filtered_children: * @list_box: a #GtkListBox. * @filter_func: (scope call): non-%NULL callback function. * @user_data: user data passed to @filter_func. * @n_filtered_children: (out) (optional): location to store the number of * #GtkListBoxRow's present in the returned array, without counting the * terminating %NULL. * * Gets an array of all the #GtkListBoxRow childen of @list_box for which * @filter_func returns %TRUE. The elements in the array are sorted by * increasing index order (as returned by gtk_list_box_row_get_index()). * * Returns: (array zero-terminated=1) (element-type GtkListBoxRow) (transfer container) (nullable): * a %NULL-terminated array of #GtkListBoxRow objects, or %NULL. Free with * g_free() when no longer needed. * Since: 6.0 */ GtkListBoxRow ** tepl_utils_list_box_get_filtered_children (GtkListBox *list_box, GtkListBoxFilterFunc filter_func, gpointer user_data, gint *n_filtered_children) { GPtrArray *filtered_rows; GList *all_rows; GList *l; g_return_val_if_fail (GTK_IS_LIST_BOX (list_box), NULL); g_return_val_if_fail (filter_func != NULL, NULL); filtered_rows = g_ptr_array_new (); all_rows = gtk_container_get_children (GTK_CONTAINER (list_box)); for (l = all_rows; l != NULL; l = l->next) { GtkListBoxRow *cur_row = GTK_LIST_BOX_ROW (l->data); if (filter_func (cur_row, user_data)) { g_ptr_array_add (filtered_rows, cur_row); } } g_list_free (all_rows); if (n_filtered_children != NULL) { *n_filtered_children = filtered_rows->len; } /* NULL-terminate the array, must be done *after* setting * *n_filtered_children, of course. */ g_ptr_array_add (filtered_rows, NULL); return (GtkListBoxRow **) g_ptr_array_free (filtered_rows, FALSE); } /** * tepl_utils_override_font_description: * @widget: a #GtkWidget. * @font_desc: (nullable): the #PangoFontDescription to use, or %NULL to undo * the effect of previous calls to this function on @widget. * * A replacement for gtk_widget_override_font(). Because * gtk_widget_override_font() is deprecated but was useful. * * See also tepl_pango_font_description_to_css(). * * Since: 6.2 */ void tepl_utils_override_font_description (GtkWidget *widget, const PangoFontDescription *font_desc) { GtkStyleContext *style_context; GtkCssProvider *css_provider; gchar *css_declarations; gchar *css_rule_set; #define FONT_CSS_PROVIDER_KEY "tepl-utils-override-font-css-provider-key" g_return_if_fail (GTK_IS_WIDGET (widget)); style_context = gtk_widget_get_style_context (widget); css_provider = g_object_get_data (G_OBJECT (widget), FONT_CSS_PROVIDER_KEY); if (css_provider != NULL) { gtk_style_context_remove_provider (style_context, GTK_STYLE_PROVIDER (css_provider)); g_object_set_data (G_OBJECT (widget), FONT_CSS_PROVIDER_KEY, NULL); css_provider = NULL; } if (font_desc == NULL) { return; } css_declarations = tepl_pango_font_description_to_css (font_desc); css_rule_set = g_strdup_printf ("* {\n" " %s\n" "}\n", css_declarations); css_provider = gtk_css_provider_new (); g_object_set_data_full (G_OBJECT (widget), FONT_CSS_PROVIDER_KEY, css_provider, g_object_unref); gtk_css_provider_load_from_data (css_provider, css_rule_set, -1, NULL); gtk_style_context_add_provider (style_context, GTK_STYLE_PROVIDER (css_provider), TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY); g_free (css_declarations); g_free (css_rule_set); } /** * tepl_utils_override_font_string: * @widget: a #GtkWidget. * @font_str: (nullable): a string representation of a #PangoFontDescription, or * %NULL to undo the effect of previous calls to this function on @widget. * * A convenience function that calls tepl_utils_override_font_description(). * * See pango_font_description_from_string() for a description of the format of * the string representation for @font_str. * * Since: 6.2 */ void tepl_utils_override_font_string (GtkWidget *widget, const gchar *font_str) { g_return_if_fail (GTK_IS_WIDGET (widget)); if (font_str == NULL) { tepl_utils_override_font_description (widget, NULL); } else { PangoFontDescription *font_desc; font_desc = pango_font_description_from_string (font_str); g_return_if_fail (font_desc != NULL); tepl_utils_override_font_description (widget, font_desc); pango_font_description_free (font_desc); } } /** * tepl_utils_get_titled_component: * @title: the title. * @component: a #GtkWidget. * * To add a title to a GUI component. * * Useful for example in a #GtkDialog window, when there are several components, * or logical groups. * * The title will be in bold, left-aligned, and the @component will have a left * margin. * * Returns: (transfer floating): a new widget containing the @title above the * @component. * Since: 6.2 */ GtkWidget * tepl_utils_get_titled_component (const gchar *title, GtkWidget *component) { GtkContainer *vgrid; GtkWidget *label; gchar *markup; g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (GTK_IS_WIDGET (component), NULL); vgrid = GTK_CONTAINER (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (vgrid), 6); /* Title in bold, left-aligned. */ label = gtk_label_new (NULL); markup = g_strdup_printf ("%s", title); gtk_label_set_markup (GTK_LABEL (label), markup); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_container_add (vgrid, label); /* Left margin for the component. */ gtk_widget_set_margin_start (component, 12); gtk_container_add (vgrid, component); gtk_widget_show_all (GTK_WIDGET (vgrid)); g_free (markup); return GTK_WIDGET (vgrid); } /** * tepl_utils_setup_statusbar: * @statusbar: a #GtkStatusbar. * * To better configure a #GtkStatusbar (to make it smaller). * * Since: 6.8 */ void tepl_utils_setup_statusbar (GtkStatusbar *statusbar) { g_return_if_fail (GTK_IS_STATUSBAR (statusbar)); g_object_set (statusbar, "margin", 0, NULL); } /** * tepl_utils_set_widget: * @widget_ptr: a pointer to a #GtkWidget. * @new_widget: (nullable): the new #GtkWidget. * * Like g_set_object() but for a #GtkWidget and without the return value. * * It connects and disconnects the #GtkWidget::destroy signal. * * Since: 6.11 */ void tepl_utils_set_widget (GtkWidget **widget_ptr, GtkWidget *new_widget) { g_return_if_fail (widget_ptr != NULL); g_return_if_fail (*widget_ptr == NULL || GTK_IS_WIDGET (*widget_ptr)); g_return_if_fail (new_widget == NULL || GTK_IS_WIDGET (new_widget)); if (*widget_ptr == new_widget) { return; } if (new_widget != NULL) { g_object_ref_sink (new_widget); } if (*widget_ptr != NULL) { g_signal_handlers_disconnect_by_func (*widget_ptr, gtk_widget_destroyed, widget_ptr); g_object_unref (*widget_ptr); } *widget_ptr = new_widget; if (*widget_ptr != NULL) { g_signal_connect (*widget_ptr, "destroy", G_CALLBACK (gtk_widget_destroyed), widget_ptr); } } /** * tepl_utils_get_toplevel_window: * @widget: a #GtkWidget. * * Like gtk_widget_get_toplevel(), but checks that the toplevel widget is a * #GtkWindow. * * Returns: (transfer none) (nullable): the toplevel #GtkWindow, or %NULL. * Since: 6.13 */ GtkWindow * tepl_utils_get_toplevel_window (GtkWidget *widget) { GtkWidget *toplevel; g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); toplevel = gtk_widget_get_toplevel (widget); if (gtk_widget_is_toplevel (toplevel) && GTK_IS_WINDOW (toplevel)) { return GTK_WINDOW (toplevel); } return NULL; } /** * tepl_utils_binding_transform_func_smart_bool: * @binding: a #GBinding. * @from_value: the #GValue containing the value to transform. * @to_value: the #GValue in which to store the transformed value. * @user_data: data passed to the transform function. * * A #GBindingTransformFunc to transform between these two #GValue types: * - A #GValue of type #gboolean. * - A #GValue of type #GVariant, with the #GVariant of type boolean. * * For convenience, this function works in both directions (hence the “smart”), * it introspects the types of @from_value and @to_value. * * Note that if @from_value and @to_value are of the same #GValue type, this * function won't work and you shouldn't use a custom #GBindingTransformFunc in * the first place. * * Returns: %TRUE if the transformation was successful, and %FALSE otherwise. * Since: 5.0 */ gboolean tepl_utils_binding_transform_func_smart_bool (GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data) { g_return_val_if_fail (G_IS_VALUE (from_value), FALSE); g_return_val_if_fail (G_IS_VALUE (to_value), FALSE); if (G_VALUE_TYPE (from_value) == G_TYPE_BOOLEAN && G_VALUE_TYPE (to_value) == G_TYPE_VARIANT) { gboolean bool_value; bool_value = g_value_get_boolean (from_value); g_value_set_variant (to_value, g_variant_new_boolean (bool_value)); return TRUE; } else if (G_VALUE_TYPE (from_value) == G_TYPE_VARIANT && G_VALUE_TYPE (to_value) == G_TYPE_BOOLEAN) { GVariant *variant_value; gboolean bool_value; variant_value = g_value_get_variant (from_value); if (variant_value == NULL) { return FALSE; } if (!g_variant_type_equal (g_variant_get_type (variant_value), G_VARIANT_TYPE_BOOLEAN)) { return FALSE; } bool_value = g_variant_get_boolean (variant_value); g_value_set_boolean (to_value, bool_value); return TRUE; } return FALSE; } /** * tepl_utils_can_use_gsettings_schema: * @schema_id: a #GSettings schema ID. * * Checks that a #GSettings schema exists. * * Especially useful for external #GSettings (provided by another application * for instance). * * Returns: %TRUE if a #GSettings instance can be created with @schema_id. * %FALSE otherwise (in that case the program would crash). * Since: 6.2 */ gboolean tepl_utils_can_use_gsettings_schema (const gchar *schema_id) { GSettingsSchemaSource *source; GSettingsSchema *schema; g_return_val_if_fail (schema_id != NULL, FALSE); source = g_settings_schema_source_get_default (); if (source == NULL) { return FALSE; } schema = g_settings_schema_source_lookup (source, schema_id, TRUE); if (schema == NULL) { return FALSE; } g_settings_schema_unref (schema); return TRUE; } /** * tepl_utils_can_use_gsettings_key: * @settings: a #GSettings object. * @key: the key to introspect. * * Especially useful for external #GSettings (provided by another application * for instance). * * See also: tepl_utils_can_use_gsettings_schema() which is typically used * before this function. * * Returns: whether the #GSettings key exists. * Since: 6.2 */ gboolean tepl_utils_can_use_gsettings_key (GSettings *settings, const gchar *key) { GSettingsSchema *schema = NULL; gboolean can_use; g_return_val_if_fail (G_IS_SETTINGS (settings), FALSE); g_return_val_if_fail (key != NULL, FALSE); g_object_get (settings, "settings-schema", &schema, NULL); g_return_val_if_fail (schema != NULL, FALSE); can_use = g_settings_schema_has_key (schema, key); g_settings_schema_unref (schema); return can_use; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-utils.h000066400000000000000000000115731526404732400254420ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_UTILS_H #define TEPL_UTILS_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS /* Macros */ /** * TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY: * * A priority that can be used when adding a #GtkStyleProvider for * library-specific style information. * * Has a higher priority than %GTK_STYLE_PROVIDER_PRIORITY_SETTINGS and a lower * priority than %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION. * * The Tepl library uses this priority for its #GtkStyleProvider's. * * Since: 6.0 */ #define TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1) /* String utilities */ G_MODULE_EXPORT gchar * tepl_utils_str_middle_truncate (const gchar *str, guint truncate_length); G_MODULE_EXPORT gchar * tepl_utils_str_end_truncate (const gchar *str, guint truncate_length); G_MODULE_EXPORT gchar * tepl_utils_str_replace (const gchar *string, const gchar *search, const gchar *replacement); G_MODULE_EXPORT gchar * tepl_utils_markup_escape_text (const gchar *src); G_GNUC_INTERNAL gchar * _tepl_utils_statusbar_add_padding_to_text (const gchar *text); /* File utilities */ G_MODULE_EXPORT gchar * tepl_utils_get_file_extension (const gchar *filename); G_MODULE_EXPORT gchar * tepl_utils_get_file_shortname (const gchar *filename); G_GNUC_INTERNAL gchar * _tepl_utils_replace_home_dir_with_tilde_with_param (const gchar *filename, const gchar *home_dir); G_MODULE_EXPORT gchar * tepl_utils_replace_home_dir_with_tilde (const gchar *filename); G_MODULE_EXPORT gboolean tepl_utils_decode_uri (const gchar *uri, gchar **scheme, gchar **user, gchar **host, gchar **port, gchar **path); G_GNUC_INTERNAL gchar * _tepl_utils_get_fallback_basename_for_display (GFile *location); G_MODULE_EXPORT gboolean tepl_utils_create_parent_directories (GFile *file, GCancellable *cancellable, GError **error); G_MODULE_EXPORT void tepl_utils_file_query_exists_async (GFile *file, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); G_MODULE_EXPORT gboolean tepl_utils_file_query_exists_finish (GFile *file, GAsyncResult *result); /* Widget utilities */ G_MODULE_EXPORT GtkWidget * tepl_utils_create_close_button (void); G_GNUC_INTERNAL void _tepl_utils_associate_secondary_window (GtkWindow *secondary_window, GtkWidget *main_window_widget); G_MODULE_EXPORT void tepl_utils_show_warning_dialog (GtkWindow *parent, const gchar *format, ...) G_GNUC_PRINTF(2, 3); G_MODULE_EXPORT void tepl_utils_list_box_clear (GtkListBox *list_box); G_MODULE_EXPORT void tepl_utils_list_box_setup_scrolling (GtkListBox *list_box, GtkScrolledWindow *scrolled_window); G_MODULE_EXPORT void tepl_utils_list_box_scroll_to_row (GtkListBox *list_box, GtkListBoxRow *row); G_MODULE_EXPORT void tepl_utils_list_box_scroll_to_selected_row (GtkListBox *list_box); G_MODULE_EXPORT GtkListBoxRow * tepl_utils_list_box_get_row_at_index_with_filter (GtkListBox *list_box, gint index, GtkListBoxFilterFunc filter_func, gpointer user_data); G_MODULE_EXPORT GtkListBoxRow **tepl_utils_list_box_get_filtered_children (GtkListBox *list_box, GtkListBoxFilterFunc filter_func, gpointer user_data, gint *n_filtered_children); G_MODULE_EXPORT void tepl_utils_override_font_description (GtkWidget *widget, const PangoFontDescription *font_desc); G_MODULE_EXPORT void tepl_utils_override_font_string (GtkWidget *widget, const gchar *font_str); G_MODULE_EXPORT GtkWidget * tepl_utils_get_titled_component (const gchar *title, GtkWidget *component); G_MODULE_EXPORT void tepl_utils_setup_statusbar (GtkStatusbar *statusbar); G_MODULE_EXPORT void tepl_utils_set_widget (GtkWidget **widget_ptr, GtkWidget *new_widget); G_MODULE_EXPORT GtkWindow * tepl_utils_get_toplevel_window (GtkWidget *widget); /* Other */ G_MODULE_EXPORT gboolean tepl_utils_binding_transform_func_smart_bool (GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data); G_MODULE_EXPORT gboolean tepl_utils_can_use_gsettings_schema (const gchar *schema_id); G_MODULE_EXPORT gboolean tepl_utils_can_use_gsettings_key (GSettings *settings, const gchar *key); G_END_DECLS #endif /* TEPL_UTILS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-view.c000066400000000000000000000260651526404732400252510ustar00rootroot00000000000000/* From gedit-view.c: * SPDX-FileCopyrightText: 1998, 1999 - Alex Roberts, Evan Lawrence * SPDX-FileCopyrightText: 2000, 2002 - Chema Celorio, Paolo Maggi * SPDX-FileCopyrightText: 2003-2005 - Paolo Maggi * * SPDX-FileCopyrightText: 2016-2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-view.h" #include "tepl-buffer.h" /** * SECTION:view * @Short_description: Subclass of #GtkSourceView * @Title: TeplView * * #TeplView is a subclass of #GtkSourceView, to add more features useful for a * text editor. */ #define SCROLL_MARGIN 0.02 G_DEFINE_TYPE (TeplView, tepl_view, GTK_SOURCE_TYPE_VIEW) static GtkTextBuffer * tepl_view_create_buffer (GtkTextView *view) { return GTK_TEXT_BUFFER (tepl_buffer_new ()); } static void set_to_line_end (GtkTextIter *iter) { if (!gtk_text_iter_ends_line (iter)) { gtk_text_iter_forward_to_line_end (iter); } } static void get_extents_for_lines_deletion (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end) { gboolean has_selection; has_selection = gtk_text_buffer_get_selection_bounds (buffer, start, end); gtk_text_iter_set_line_offset (start, 0); if (has_selection && gtk_text_iter_starts_line (end)) { /* In this case, the GtkTextView displays the selection only on * the previous line(s), not on the line where 'end' is, so * don't delete the line located at 'end'. */ return; } set_to_line_end (end); /* We have now the same situation with 'start' at the start of a line, * and 'end' at the end of a line, with start <= end. * We must just include one more \n (or equivalent) to not leave a blank * line as a result. */ if (!gtk_text_iter_is_end (end)) { gtk_text_iter_forward_line (end); } /* We take the \n from the previous line, if there is one. */ else if (!gtk_text_iter_is_start (start)) { gtk_text_iter_backward_line (start); set_to_line_end (start); } } static void delete_lines (GtkTextView *text_view) { GtkTextBuffer *buffer; GtkTextIter start; GtkTextIter end; gtk_text_view_reset_im_context (text_view); buffer = gtk_text_view_get_buffer (text_view); get_extents_for_lines_deletion (buffer, &start, &end); if (!gtk_text_iter_equal (&start, &end)) { GtkTextIter cursor = start; gtk_text_iter_set_line_offset (&cursor, 0); gtk_text_buffer_begin_user_action (buffer); gtk_text_buffer_place_cursor (buffer, &cursor); gtk_text_buffer_delete_interactive (buffer, &start, &end, gtk_text_view_get_editable (text_view)); gtk_text_buffer_end_user_action (buffer); gtk_text_view_scroll_mark_onscreen (text_view, gtk_text_buffer_get_insert (buffer)); } else { gtk_widget_error_bell (GTK_WIDGET (text_view)); } } /* We override the standard handler for delete_from_cursor since the * GTK_DELETE_PARAGRAPHS case is not implemented as we like (i.e. it does not * remove the newline in the previous line). * Useful for a keybinding to delete the current line. */ static void tepl_view_delete_from_cursor (GtkTextView *text_view, GtkDeleteType type, gint count) { /* For a keybinding we only care about count==1, so it permits to * simplify the implementation. */ if (type == GTK_DELETE_PARAGRAPHS && count == 1) { delete_lines (text_view); return; } if (GTK_TEXT_VIEW_CLASS (tepl_view_parent_class)->delete_from_cursor != NULL) { GTK_TEXT_VIEW_CLASS (tepl_view_parent_class)->delete_from_cursor (text_view, type, count); } } static void tepl_view_class_init (TeplViewClass *klass) { GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass); text_view_class->create_buffer = tepl_view_create_buffer; text_view_class->delete_from_cursor = tepl_view_delete_from_cursor; } static void tepl_view_init (TeplView *view) { } /** * tepl_view_new: * * Creates a new #TeplView. * * By default, an empty #TeplBuffer will be lazily created and can be retrieved * with gtk_text_view_get_buffer(). * * If you want to specify your own buffer, either override the * #GtkTextViewClass create_buffer factory method, or use * tepl_view_new_with_buffer(). * * Returns: a new #TeplView. * Since: 1.0 */ GtkWidget * tepl_view_new (void) { return g_object_new (TEPL_TYPE_VIEW, NULL); } /** * tepl_view_new_with_buffer: * @buffer: a #GtkSourceBuffer or a subclass of it. * * Creates a new #TeplView widget displaying the buffer @buffer. * * Returns: a new #TeplView. * Since: 5.0 */ GtkWidget * tepl_view_new_with_buffer (GtkSourceBuffer *buffer) { g_return_val_if_fail (GTK_SOURCE_IS_BUFFER (buffer), NULL); return g_object_new (TEPL_TYPE_VIEW, "buffer", buffer, NULL); } /** * tepl_view_cut_clipboard: * @view: a #TeplView. * * Cuts the clipboard and then scrolls to the cursor position. * * Since: 1.0 */ void tepl_view_cut_clipboard (TeplView *view) { GtkTextBuffer *buffer; GtkClipboard *clipboard; g_return_if_fail (TEPL_IS_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view), GDK_SELECTION_CLIPBOARD); gtk_text_buffer_cut_clipboard (buffer, clipboard, gtk_text_view_get_editable (GTK_TEXT_VIEW (view))); gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view), gtk_text_buffer_get_insert (buffer), SCROLL_MARGIN, FALSE, 0.0, 0.0); } /** * tepl_view_copy_clipboard: * @view: a #TeplView. * * Copies the clipboard. * * Since: 1.0 */ void tepl_view_copy_clipboard (TeplView *view) { GtkTextBuffer *buffer; GtkClipboard *clipboard; g_return_if_fail (TEPL_IS_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view), GDK_SELECTION_CLIPBOARD); gtk_text_buffer_copy_clipboard (buffer, clipboard); /* On copy do not scroll, we are already on screen. */ } /** * tepl_view_paste_clipboard: * @view: a #TeplView. * * Pastes the clipboard and then scrolls to the cursor position. * * Since: 1.0 */ void tepl_view_paste_clipboard (TeplView *view) { GtkTextBuffer *buffer; GtkClipboard *clipboard; g_return_if_fail (TEPL_IS_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view), GDK_SELECTION_CLIPBOARD); gtk_text_buffer_paste_clipboard (buffer, clipboard, NULL, gtk_text_view_get_editable (GTK_TEXT_VIEW (view))); /* GtkTextView already connects to the GtkTextBuffer::paste-done signal * to scroll to the cursor position. */ } /** * tepl_view_delete_selection: * @view: a #TeplView. * * Deletes the text currently selected in the #GtkTextBuffer associated * to the view and then scrolls to the cursor position. * * Since: 1.0 */ void tepl_view_delete_selection (TeplView *view) { GtkTextBuffer *buffer; g_return_if_fail (TEPL_IS_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_delete_selection (buffer, TRUE, gtk_text_view_get_editable (GTK_TEXT_VIEW (view))); gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view), gtk_text_buffer_get_insert (buffer), SCROLL_MARGIN, FALSE, 0.0, 0.0); } /** * tepl_view_select_all: * @view: a #TeplView. * * Selects all the text. * * Since: 1.0 */ void tepl_view_select_all (TeplView *view) { GtkTextBuffer *buffer; GtkTextIter start; GtkTextIter end; g_return_if_fail (TEPL_IS_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_get_bounds (buffer, &start, &end); gtk_text_buffer_select_range (buffer, &start, &end); } /** * tepl_view_scroll_to_cursor: * @view: a #TeplView. * * Scrolls the @view to the cursor position. * * Since: 1.0 */ void tepl_view_scroll_to_cursor (TeplView *view) { GtkTextBuffer *buffer; g_return_if_fail (TEPL_IS_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view), gtk_text_buffer_get_insert (buffer), 0.25, FALSE, 0.0, 0.0); } /** * tepl_view_goto_line: * @view: a #TeplView. * @line: a line number, counting from 0. * * Places the cursor at the position returned by * gtk_text_buffer_get_iter_at_line(), and scrolls to that position. * * Returns: %TRUE if the cursor has been moved exactly to @line, %FALSE if that * line didn't exist. * Since: 2.0 */ gboolean tepl_view_goto_line (TeplView *view, gint line) { GtkTextBuffer *buffer; GtkTextIter iter; gboolean line_exists; g_return_val_if_fail (TEPL_IS_VIEW (view), FALSE); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_get_iter_at_line (buffer, &iter, line); line_exists = gtk_text_iter_get_line (&iter) == line; gtk_text_buffer_place_cursor (buffer, &iter); tepl_view_scroll_to_cursor (view); return line_exists; } /** * tepl_view_goto_line_offset: * @view: a #TeplView. * @line: a line number, counting from 0. * @line_offset: the line offset, in characters (not bytes). * * Places the cursor at the position returned by * gtk_text_buffer_get_iter_at_line_offset(), and scrolls to that position. * * Returns: %TRUE if the cursor has been moved exactly to @line and * @line_offset, %FALSE if that position didn't exist. * Since: 2.0 */ gboolean tepl_view_goto_line_offset (TeplView *view, gint line, gint line_offset) { GtkTextBuffer *buffer; GtkTextIter iter; gboolean pos_exists; g_return_val_if_fail (TEPL_IS_VIEW (view), FALSE); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, line, line_offset); pos_exists = (gtk_text_iter_get_line (&iter) == line && gtk_text_iter_get_line_offset (&iter) == line_offset); gtk_text_buffer_place_cursor (buffer, &iter); tepl_view_scroll_to_cursor (view); return pos_exists; } /** * tepl_view_select_lines: * @view: a #TeplView. * @start_line: start of the region to select. * @end_line: end of the region to select. * * Selects the lines between @start_line and @end_line included, counting from * zero. And then scrolls to the cursor. * * Possible use-case: line numbers coming from a compilation output, to go to * the place where a warning or error occurred. * * Since: 2.0 */ void tepl_view_select_lines (TeplView *view, gint start_line, gint end_line) { GtkTextBuffer *buffer; GtkTextIter start_iter; GtkTextIter end_iter; g_return_if_fail (TEPL_IS_VIEW (view)); if (end_line < start_line) { gint start_line_copy; /* Swap start_line and end_line */ start_line_copy = start_line; start_line = end_line; end_line = start_line_copy; } buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_get_iter_at_line (buffer, &start_iter, start_line); gtk_text_buffer_get_iter_at_line (buffer, &end_iter, end_line); if (!gtk_text_iter_ends_line (&end_iter)) { gtk_text_iter_forward_to_line_end (&end_iter); } gtk_text_buffer_select_range (buffer, &start_iter, &end_iter); tepl_view_scroll_to_cursor (view); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-view.h000066400000000000000000000027721526404732400252550ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_VIEW_H #define TEPL_VIEW_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS #define TEPL_TYPE_VIEW (tepl_view_get_type ()) G_MODULE_EXPORT G_DECLARE_DERIVABLE_TYPE (TeplView, tepl_view, TEPL, VIEW, GtkSourceView) struct _TeplViewClass { GtkSourceViewClass parent_class; gpointer padding[12]; }; G_MODULE_EXPORT GtkWidget * tepl_view_new (void); G_MODULE_EXPORT GtkWidget * tepl_view_new_with_buffer (GtkSourceBuffer *buffer); G_MODULE_EXPORT void tepl_view_cut_clipboard (TeplView *view); G_MODULE_EXPORT void tepl_view_copy_clipboard (TeplView *view); G_MODULE_EXPORT void tepl_view_paste_clipboard (TeplView *view); G_MODULE_EXPORT void tepl_view_delete_selection (TeplView *view); G_MODULE_EXPORT void tepl_view_select_all (TeplView *view); G_MODULE_EXPORT void tepl_view_scroll_to_cursor (TeplView *view); G_MODULE_EXPORT gboolean tepl_view_goto_line (TeplView *view, gint line); G_MODULE_EXPORT gboolean tepl_view_goto_line_offset (TeplView *view, gint line, gint line_offset); G_MODULE_EXPORT void tepl_view_select_lines (TeplView *view, gint start_line, gint end_line); G_END_DECLS #endif /* TEPL_VIEW_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-actions-edit.c000066400000000000000000000424201526404732400301600ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-window-actions-edit.h" #include #include "tepl-signal-group.h" #include "tepl-tab-group.h" #include "tepl-view.h" /* TeplApplicationWindow GActions for the Edit menu. */ struct _TeplWindowActionsEdit { TeplApplicationWindow *tepl_window; /* unowned */ TeplSignalGroup *tepl_window_signal_group; TeplSignalGroup *view_signal_group; TeplSignalGroup *buffer_signal_group; TeplSignalGroup *clipboard_signal_group; }; /******************************************************************************/ /* Activate callbacks */ static void undo_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *view; view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (view != NULL) { TeplBuffer *buffer; buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); gtk_source_buffer_undo (GTK_SOURCE_BUFFER (buffer)); tepl_view_scroll_to_cursor (view); gtk_widget_grab_focus (GTK_WIDGET (view)); } } static void redo_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *view; view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (view != NULL) { TeplBuffer *buffer; buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); gtk_source_buffer_redo (GTK_SOURCE_BUFFER (buffer)); tepl_view_scroll_to_cursor (view); gtk_widget_grab_focus (GTK_WIDGET (view)); } } static void cut_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *active_view; active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (active_view != NULL) { tepl_view_cut_clipboard (active_view); } } static void copy_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *active_view; active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (active_view != NULL) { tepl_view_copy_clipboard (active_view); } } static void paste_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *active_view; active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (active_view != NULL) { tepl_view_paste_clipboard (active_view); } } static void delete_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *active_view; active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (active_view != NULL) { tepl_view_delete_selection (active_view); } } static void select_all_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *active_view; active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (active_view != NULL) { tepl_view_select_all (active_view); } } static void indent_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *view; view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (view != NULL) { TeplBuffer *buffer; GtkTextIter start; GtkTextIter end; buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer), &start, &end); gtk_source_view_indent_lines (GTK_SOURCE_VIEW (view), &start, &end); } } static void unindent_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplView *view; view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (view != NULL) { TeplBuffer *buffer; GtkTextIter start; GtkTextIter end; buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer), &start, &end); gtk_source_view_unindent_lines (GTK_SOURCE_VIEW (view), &start, &end); } } /******************************************************************************/ /* Update sensitivity */ static void update_undo_redo_actions_sensitivity (TeplApplicationWindow *tepl_window) { TeplView *view; gboolean view_is_editable = FALSE; GtkSourceBuffer *buffer; GActionMap *action_map; GAction *action; view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (view != NULL) { view_is_editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view)); } buffer = GTK_SOURCE_BUFFER (tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window))); action_map = G_ACTION_MAP (tepl_application_window_get_application_window (tepl_window)); action = g_action_map_lookup_action (action_map, "tepl-undo"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), view_is_editable && buffer != NULL && gtk_source_buffer_can_undo (buffer)); action = g_action_map_lookup_action (action_map, "tepl-redo"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), view_is_editable && buffer != NULL && gtk_source_buffer_can_redo (buffer)); } /* @can_paste_according_to_clipboard: TRUE if calling * tepl_view_paste_clipboard() will paste something. */ static void set_paste_action_sensitivity_according_to_clipboard (TeplApplicationWindow *tepl_window, gboolean can_paste_according_to_clipboard) { TeplView *view; gboolean view_is_editable = FALSE; GActionMap *action_map; GAction *action; view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); if (view != NULL) { view_is_editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view)); } action_map = G_ACTION_MAP (tepl_application_window_get_application_window (tepl_window)); action = g_action_map_lookup_action (action_map, "tepl-paste"); /* Since this is called async, the disposal of the actions may have * already happened. Ensure that we have an action before setting the * state. */ if (action != NULL) { g_simple_action_set_enabled (G_SIMPLE_ACTION (action), view_is_editable && can_paste_according_to_clipboard); } } static void clipboard_targets_received_cb (GtkClipboard *clipboard, GdkAtom *atoms, gint n_atoms, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); GtkApplicationWindow *gtk_window; TeplBuffer *active_buffer; GtkTargetList *target_list; gboolean can_paste = FALSE; gint i; active_buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); if (active_buffer == NULL) { goto end; } target_list = gtk_text_buffer_get_paste_target_list (GTK_TEXT_BUFFER (active_buffer)); for (i = 0; i < n_atoms; i++) { if (gtk_target_list_find (target_list, atoms[i], NULL)) { can_paste = TRUE; break; } } end: set_paste_action_sensitivity_according_to_clipboard (tepl_window, can_paste); /* Async operation finished. */ gtk_window = tepl_application_window_get_application_window (tepl_window); g_object_unref (gtk_window); } /* How to test this easily: with a clipboard manager like xsel: * $ xsel --clipboard --clear * $ echo -n 'bloum!' | xsel --clipboard # -> GdkAtom "TEXT" * Copy text in a GtkTextBuffer -> GdkAtom "GTK_TEXT_BUFFER_CONTENTS" */ static void update_paste_action_sensitivity (TeplApplicationWindow *tepl_window) { GtkApplicationWindow *gtk_window; GtkClipboard *clipboard; GdkDisplay *display; gtk_window = tepl_application_window_get_application_window (tepl_window); clipboard = gtk_widget_get_clipboard (GTK_WIDGET (gtk_window), GDK_SELECTION_CLIPBOARD); g_return_if_fail (clipboard != NULL); display = gtk_clipboard_get_display (clipboard); if (!gdk_display_supports_selection_notification (display)) { /* Do as if it can always paste, because if we set the paste * action as insensitive, we won't get the notification when the * clipboard contains something that we can paste (i.e. * clipboard_owner_change_cb() will not be called). */ set_paste_action_sensitivity_according_to_clipboard (tepl_window, TRUE); return; } g_object_ref (gtk_window); gtk_clipboard_request_targets (clipboard, clipboard_targets_received_cb, tepl_window); } static void update_basic_edit_actions_sensitivity (TeplApplicationWindow *tepl_window) { TeplView *view; TeplBuffer *buffer; gboolean view_is_editable = FALSE; gboolean buffer_has_selection = FALSE; GActionMap *action_map; GAction *action; view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window)); buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); if (view != NULL) { view_is_editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view)); } if (buffer != NULL) { buffer_has_selection = gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (buffer)); } action_map = G_ACTION_MAP (tepl_application_window_get_application_window (tepl_window)); action = g_action_map_lookup_action (action_map, "tepl-cut"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), view_is_editable && buffer_has_selection); action = g_action_map_lookup_action (action_map, "tepl-copy"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), buffer_has_selection); /* tepl-paste is treated separately with * update_paste_action_sensitivity(), to request the clipboard only when * necessary. */ action = g_action_map_lookup_action (action_map, "tepl-delete"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), view_is_editable && buffer_has_selection); action = g_action_map_lookup_action (action_map, "tepl-select-all"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), buffer != NULL); action = g_action_map_lookup_action (action_map, "tepl-indent"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), view_is_editable); action = g_action_map_lookup_action (action_map, "tepl-unindent"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), view_is_editable); } static void active_view_editable_notify_cb (GtkTextView *active_view, GParamSpec *pspec, TeplWindowActionsEdit *window_actions_edit) { update_undo_redo_actions_sensitivity (window_actions_edit->tepl_window); update_paste_action_sensitivity (window_actions_edit->tepl_window); update_basic_edit_actions_sensitivity (window_actions_edit->tepl_window); } static void active_view_changed (TeplWindowActionsEdit *window_actions_edit) { TeplView *active_view; tepl_signal_group_clear (&window_actions_edit->view_signal_group); active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (window_actions_edit->tepl_window)); if (active_view == NULL) { goto end; } window_actions_edit->view_signal_group = tepl_signal_group_new (G_OBJECT (active_view)); tepl_signal_group_add (window_actions_edit->view_signal_group, g_signal_connect (active_view, "notify::editable", G_CALLBACK (active_view_editable_notify_cb), window_actions_edit)); end: update_undo_redo_actions_sensitivity (window_actions_edit->tepl_window); update_paste_action_sensitivity (window_actions_edit->tepl_window); update_basic_edit_actions_sensitivity (window_actions_edit->tepl_window); } static void active_view_notify_cb (TeplApplicationWindow *tepl_window, GParamSpec *pspec, TeplWindowActionsEdit *window_actions_edit) { active_view_changed (window_actions_edit); } static void active_buffer_can_undo_notify_cb (GtkSourceBuffer *buffer, GParamSpec *pspec, TeplWindowActionsEdit *window_actions_edit) { update_undo_redo_actions_sensitivity (window_actions_edit->tepl_window); } static void active_buffer_can_redo_notify_cb (GtkSourceBuffer *buffer, GParamSpec *pspec, TeplWindowActionsEdit *window_actions_edit) { update_undo_redo_actions_sensitivity (window_actions_edit->tepl_window); } static void active_buffer_has_selection_notify_cb (GtkTextBuffer *buffer, GParamSpec *pspec, TeplWindowActionsEdit *window_actions_edit) { update_basic_edit_actions_sensitivity (window_actions_edit->tepl_window); } static void active_buffer_changed (TeplWindowActionsEdit *window_actions_edit) { TeplBuffer *active_buffer; tepl_signal_group_clear (&window_actions_edit->buffer_signal_group); active_buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (window_actions_edit->tepl_window)); if (active_buffer == NULL) { goto end; } window_actions_edit->buffer_signal_group = tepl_signal_group_new (G_OBJECT (active_buffer)); tepl_signal_group_add (window_actions_edit->buffer_signal_group, g_signal_connect (active_buffer, "notify::can-undo", G_CALLBACK (active_buffer_can_undo_notify_cb), window_actions_edit)); tepl_signal_group_add (window_actions_edit->buffer_signal_group, g_signal_connect (active_buffer, "notify::can-redo", G_CALLBACK (active_buffer_can_redo_notify_cb), window_actions_edit)); tepl_signal_group_add (window_actions_edit->buffer_signal_group, g_signal_connect (active_buffer, "notify::has-selection", G_CALLBACK (active_buffer_has_selection_notify_cb), window_actions_edit)); end: update_undo_redo_actions_sensitivity (window_actions_edit->tepl_window); update_basic_edit_actions_sensitivity (window_actions_edit->tepl_window); } static void active_buffer_notify_cb (TeplApplicationWindow *tepl_window, GParamSpec *pspec, TeplWindowActionsEdit *window_actions_edit) { active_buffer_changed (window_actions_edit); } static void clipboard_owner_change_cb (GtkClipboard *clipboard, GdkEvent *event, TeplWindowActionsEdit *window_actions_edit) { update_paste_action_sensitivity (window_actions_edit->tepl_window); } /******************************************************************************/ /* Public functions */ TeplWindowActionsEdit * _tepl_window_actions_edit_new (TeplApplicationWindow *tepl_window) { GtkApplicationWindow *gtk_window; TeplWindowActionsEdit *window_actions_edit; GtkClipboard *clipboard; const GActionEntry entries[] = { { "tepl-undo", undo_activate_cb }, { "tepl-redo", redo_activate_cb }, { "tepl-cut", cut_activate_cb }, { "tepl-copy", copy_activate_cb }, { "tepl-paste", paste_activate_cb }, { "tepl-delete", delete_activate_cb }, { "tepl-select-all", select_all_activate_cb }, { "tepl-indent", indent_activate_cb }, { "tepl-unindent", unindent_activate_cb }, }; g_return_val_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window), NULL); gtk_window = tepl_application_window_get_application_window (tepl_window); amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (gtk_window), entries, G_N_ELEMENTS (entries), tepl_window); window_actions_edit = g_new0 (TeplWindowActionsEdit, 1); window_actions_edit->tepl_window = tepl_window; window_actions_edit->tepl_window_signal_group = tepl_signal_group_new (G_OBJECT (tepl_window)); tepl_signal_group_add (window_actions_edit->tepl_window_signal_group, g_signal_connect (tepl_window, "notify::active-view", G_CALLBACK (active_view_notify_cb), window_actions_edit)); tepl_signal_group_add (window_actions_edit->tepl_window_signal_group, g_signal_connect (tepl_window, "notify::active-buffer", G_CALLBACK (active_buffer_notify_cb), window_actions_edit)); clipboard = gtk_widget_get_clipboard (GTK_WIDGET (gtk_window), GDK_SELECTION_CLIPBOARD); window_actions_edit->clipboard_signal_group = tepl_signal_group_new (G_OBJECT (clipboard)); tepl_signal_group_add (window_actions_edit->clipboard_signal_group, g_signal_connect (clipboard, "owner-change", G_CALLBACK (clipboard_owner_change_cb), window_actions_edit)); active_view_changed (window_actions_edit); active_buffer_changed (window_actions_edit); return window_actions_edit; } static void window_actions_edit_free (TeplWindowActionsEdit *window_actions_edit) { if (window_actions_edit == NULL) { return; } tepl_signal_group_clear (&window_actions_edit->tepl_window_signal_group); tepl_signal_group_clear (&window_actions_edit->view_signal_group); tepl_signal_group_clear (&window_actions_edit->buffer_signal_group); tepl_signal_group_clear (&window_actions_edit->clipboard_signal_group); g_free (window_actions_edit); } void _tepl_window_actions_edit_clear (TeplWindowActionsEdit **window_actions_edit_p) { g_return_if_fail (window_actions_edit_p != NULL); window_actions_edit_free (*window_actions_edit_p); *window_actions_edit_p = NULL; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-actions-edit.h000066400000000000000000000011001526404732400301530ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_WINDOW_ACTIONS_EDIT_H #define TEPL_WINDOW_ACTIONS_EDIT_H #include "tepl-application-window.h" G_BEGIN_DECLS typedef struct _TeplWindowActionsEdit TeplWindowActionsEdit; G_GNUC_INTERNAL TeplWindowActionsEdit * _tepl_window_actions_edit_new (TeplApplicationWindow *tepl_window); G_GNUC_INTERNAL void _tepl_window_actions_edit_clear (TeplWindowActionsEdit **window_actions_edit_p); G_END_DECLS #endif /* TEPL_WINDOW_ACTIONS_EDIT_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-actions-file.c000066400000000000000000000140351526404732400301530ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "config.h" #include "tepl-window-actions-file.h" #include #include #include "tepl-abstract-factory.h" #include "tepl-buffer.h" #include "tepl-file.h" #include "tepl-tab.h" #include "tepl-tab-group.h" #include "tepl-tab-saving.h" /* TeplApplicationWindow GActions for the File menu. */ static void new_file_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplAbstractFactory *factory; TeplTab *new_tab; factory = tepl_abstract_factory_get_singleton (); new_tab = tepl_abstract_factory_create_tab (factory); gtk_widget_show (GTK_WIDGET (new_tab)); tepl_tab_group_append_tab (TEPL_TAB_GROUP (tepl_window), new_tab, TRUE); } static void open_file_chooser_response_cb (GtkFileChooserDialog *file_chooser_dialog, gint response_id, TeplApplicationWindow *tepl_window) { if (response_id == GTK_RESPONSE_ACCEPT) { GFile *location; GtkApplicationWindow *gtk_window; location = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (file_chooser_dialog)); tepl_application_window_open_file (tepl_window, location, TRUE); g_object_unref (location); /* Present the window because it is not necessarily the most * recently focused window. */ gtk_window = tepl_application_window_get_application_window (tepl_window); gtk_window_present (GTK_WINDOW (gtk_window)); } gtk_widget_destroy (GTK_WIDGET (file_chooser_dialog)); } static void open_activate_cb (GSimpleAction *open_action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); GtkApplicationWindow *gtk_window; GtkWidget *file_chooser_dialog; GtkWindowGroup *window_group; gtk_window = tepl_application_window_get_application_window (tepl_window); /* Create a GtkFileChooserDialog, not a GtkFileChooserNative, because * with GtkFileChooserNative the GFile that we obtain (in flatpak) * doesn't have the real path to the file, so it would ruin some * features for text editors: * - showing the directory in parentheses in the window title, or in the * tab tooltip; * - opening a recent file. * Basically everywhere where the directory is shown. */ file_chooser_dialog = gtk_file_chooser_dialog_new (_("Open File"), GTK_WINDOW (gtk_window), GTK_FILE_CHOOSER_ACTION_OPEN, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Open"), GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response (GTK_DIALOG (file_chooser_dialog), GTK_RESPONSE_ACCEPT); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (file_chooser_dialog), FALSE); /* Do not set it modal, it's not absolutely required. But in that case * it's better to destroy the dialog when the main window is closed. */ gtk_window_set_destroy_with_parent (GTK_WINDOW (file_chooser_dialog), TRUE); window_group = tepl_application_window_get_window_group (tepl_window); gtk_window_group_add_window (window_group, GTK_WINDOW (file_chooser_dialog)); g_signal_connect_object (file_chooser_dialog, "response", G_CALLBACK (open_file_chooser_response_cb), tepl_window, 0); gtk_widget_show (file_chooser_dialog); } static void save_activate_cb (GSimpleAction *save_action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplTab *tab; TeplBuffer *buffer; TeplFile *file; GFile *location; tab = tepl_tab_group_get_active_tab (TEPL_TAB_GROUP (tepl_window)); g_return_if_fail (tab != NULL); buffer = tepl_tab_get_buffer (tab); file = tepl_buffer_get_file (buffer); location = tepl_file_get_location (file); if (location != NULL) { tepl_tab_save_async_simple (tab); } else { GtkApplicationWindow *gtk_window; gtk_window = tepl_application_window_get_application_window (tepl_window); g_action_group_activate_action (G_ACTION_GROUP (gtk_window), "tepl-save-as", NULL); } } static void save_as_activate_cb (GSimpleAction *save_as_action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplTab *tab; tab = tepl_tab_group_get_active_tab (TEPL_TAB_GROUP (tepl_window)); g_return_if_fail (tab != NULL); tepl_tab_save_as_async_simple (tab); } static void update_actions_sensitivity (TeplApplicationWindow *tepl_window) { TeplBuffer *buffer; GActionMap *action_map; GAction *action; buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window)); action_map = G_ACTION_MAP (tepl_application_window_get_application_window (tepl_window)); action = g_action_map_lookup_action (action_map, "tepl-save"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), buffer != NULL); action = g_action_map_lookup_action (action_map, "tepl-save-as"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), buffer != NULL); } static void active_buffer_notify_cb (TeplApplicationWindow *tepl_window, GParamSpec *pspec, gpointer user_data) { update_actions_sensitivity (tepl_window); } void _tepl_window_actions_file_add_actions (TeplApplicationWindow *tepl_window) { GtkApplicationWindow *gtk_window; const GActionEntry entries[] = { { "tepl-new-file", new_file_activate_cb }, { "tepl-open", open_activate_cb }, { "tepl-save", save_activate_cb }, { "tepl-save-as", save_as_activate_cb }, }; g_return_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window)); gtk_window = tepl_application_window_get_application_window (tepl_window); amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (gtk_window), entries, G_N_ELEMENTS (entries), tepl_window); update_actions_sensitivity (tepl_window); g_signal_connect (tepl_window, "notify::active-buffer", G_CALLBACK (active_buffer_notify_cb), NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-actions-file.h000066400000000000000000000006161526404732400301600ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_WINDOW_ACTIONS_FILE_H #define TEPL_WINDOW_ACTIONS_FILE_H #include "tepl-application-window.h" G_BEGIN_DECLS G_GNUC_INTERNAL void _tepl_window_actions_file_add_actions (TeplApplicationWindow *tepl_window); G_END_DECLS #endif /* TEPL_WINDOW_ACTIONS_FILE_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-actions-search.c000066400000000000000000000067641526404732400305130ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-window-actions-search.h" #include #include "tepl-tab.h" /* TeplApplicationWindow GActions for the Search menu. */ static void update_goto_line_action_sensitivity (TeplApplicationWindow *tepl_window) { TeplTab *active_tab; GActionMap *action_map; GAction *action; active_tab = tepl_tab_group_get_active_tab (TEPL_TAB_GROUP (tepl_window)); action_map = G_ACTION_MAP (tepl_application_window_get_application_window (tepl_window)); action = g_action_map_lookup_action (action_map, "tepl-goto-line"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), active_tab != NULL); } static void update_goto_line (TeplApplicationWindow *tepl_window) { GActionMap *action_map; GAction *goto_line_action; TeplTab *active_tab; TeplGotoLineBar *goto_line_bar; update_goto_line_action_sensitivity (tepl_window); action_map = G_ACTION_MAP (tepl_application_window_get_application_window (tepl_window)); goto_line_action = g_action_map_lookup_action (action_map, "tepl-goto-line"); active_tab = tepl_tab_group_get_active_tab (TEPL_TAB_GROUP (tepl_window)); if (active_tab == NULL) { /* FIXME: should be done when the TeplTabGroup is *empty*. When * the active_tab == NULL it's an approximation. More APIs need * to be added to TeplTabGroup. */ g_simple_action_set_state (G_SIMPLE_ACTION (goto_line_action), g_variant_new_boolean (FALSE)); return; } /* FIXME: would be nice to call * _tepl_goto_line_bar_bind_to_gaction_state() directly for all * TeplTab's, when they are added to the TeplTabGroup. */ goto_line_bar = tepl_tab_get_goto_line_bar (active_tab); _tepl_goto_line_bar_bind_to_gaction_state (goto_line_bar, goto_line_action); } static void goto_line_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); TeplTab *active_tab; g_action_change_state (G_ACTION (action), g_variant_new_boolean (TRUE)); active_tab = tepl_tab_group_get_active_tab (TEPL_TAB_GROUP (tepl_window)); if (active_tab != NULL) { TeplGotoLineBar *goto_line_bar; goto_line_bar = tepl_tab_get_goto_line_bar (active_tab); tepl_goto_line_bar_grab_focus_to_entry (goto_line_bar); } } static void goto_line_change_state_cb (GSimpleAction *action, GVariant *value, gpointer user_data) { TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data); g_simple_action_set_state (action, value); update_goto_line (tepl_window); } static void active_tab_notify_cb (TeplApplicationWindow *tepl_window, GParamSpec *pspec, gpointer user_data) { update_goto_line (tepl_window); } void _tepl_window_actions_search_add_actions (TeplApplicationWindow *tepl_window) { GtkApplicationWindow *gtk_window; const GActionEntry entries[] = { { "tepl-goto-line", goto_line_activate_cb, NULL, "false", goto_line_change_state_cb }, }; g_return_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window)); gtk_window = tepl_application_window_get_application_window (tepl_window); amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (gtk_window), entries, G_N_ELEMENTS (entries), tepl_window); update_goto_line (tepl_window); g_signal_connect (tepl_window, "notify::active-tab", G_CALLBACK (active_tab_notify_cb), NULL); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-actions-search.h000066400000000000000000000006261526404732400305070ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_WINDOW_ACTIONS_SEARCH_H #define TEPL_WINDOW_ACTIONS_SEARCH_H #include "tepl-application-window.h" G_BEGIN_DECLS G_GNUC_INTERNAL void _tepl_window_actions_search_add_actions (TeplApplicationWindow *tepl_window); G_END_DECLS #endif /* TEPL_WINDOW_ACTIONS_SEARCH_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-state.c000066400000000000000000000150661526404732400267230ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-window-state.h" /** * SECTION:window-state * @Title: TeplWindowState * @Short_description: Handle #GtkWindow state settings * * A utility for #GtkWindow. It permits to handle and remember some of its * state: * - Its size. * - Whether it is maximized. * * It is especially useful for the main window of an application, where it is * generally desirable to restore the state. * * It is assumed that #GSettings is used. When creating the first window, the * initial state is taken from the provided #GSettings keys. When a window is * closed the #GSettings are saved. When opening another window of the same * type, its initial state is copied from the last focused window of that type. */ /* The window size when it is unmaximized. */ typedef struct { gint width; gint height; /* Whether the width and height are set / known. */ guint set : 1; } UnmaximizedSize; typedef struct { GSettings *settings; UnmaximizedSize unmaximized_size; } WindowState; #define WINDOW_STATE_KEY "tepl-window-state-key" static WindowState * window_state_new (GSettings *settings) { WindowState *window_state; window_state = g_new0 (WindowState, 1); window_state->settings = g_object_ref (settings); return window_state; } static void window_state_free (WindowState *window_state) { if (window_state != NULL) { g_clear_object (&window_state->settings); g_free (window_state); } } static void set_state (GtkWindow *window, gint width, gint height, gboolean maximized) { if (width >= 0 && height >= 0) { gtk_window_set_default_size (window, width, height); } if (maximized) { gtk_window_maximize (window); } } static void get_state (GtkWindow *window, gint *width, gint *height, gboolean *maximized) { WindowState *window_state; *width = 0; *height = 0; *maximized = gtk_window_is_maximized (window); window_state = g_object_get_data (G_OBJECT (window), WINDOW_STATE_KEY); g_return_if_fail (window_state != NULL); if (*maximized) { if (window_state->unmaximized_size.set) { *width = window_state->unmaximized_size.width; *height = window_state->unmaximized_size.height; } else { gtk_window_get_default_size (window, width, height); } } else { gtk_window_get_size (window, width, height); } } static void copy_state (GtkWindow *from_window, GtkWindow *to_window) { gint width = 0; gint height = 0; gboolean maximized = FALSE; get_state (from_window, &width, &height, &maximized); set_state (to_window, width, height, maximized); } static void restore_from_settings (GtkWindow *window) { WindowState *window_state; gint width; gint height; gboolean maximized; window_state = g_object_get_data (G_OBJECT (window), WINDOW_STATE_KEY); g_return_if_fail (window_state != NULL); width = g_settings_get_int (window_state->settings, "width"); height = g_settings_get_int (window_state->settings, "height"); maximized = g_settings_get_boolean (window_state->settings, "maximized"); set_state (window, width, height, maximized); } static void save_settings (GtkWindow *window) { WindowState *window_state; gint width = 0; gint height = 0; gboolean maximized = FALSE; window_state = g_object_get_data (G_OBJECT (window), WINDOW_STATE_KEY); g_return_if_fail (window_state != NULL); get_state (window, &width, &height, &maximized); g_settings_set_int (window_state->settings, "width", width); g_settings_set_int (window_state->settings, "height", height); g_settings_set_boolean (window_state->settings, "maximized", maximized); } static gboolean delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data) { GtkWindow *window = GTK_WINDOW (widget); save_settings (window); return GDK_EVENT_PROPAGATE; } static void size_allocate_cb (GtkWidget *widget, GdkRectangle *allocation, gpointer user_data) { GtkWindow *window = GTK_WINDOW (widget); if (!gtk_window_is_maximized (window)) { WindowState *window_state; window_state = g_object_get_data (G_OBJECT (window), WINDOW_STATE_KEY); g_return_if_fail (window_state != NULL); gtk_window_get_size (window, &window_state->unmaximized_size.width, &window_state->unmaximized_size.height); window_state->unmaximized_size.set = TRUE; } } static void setup_state (GtkWindow *window, GType window_type) { GtkApplication *app; GList *windows_list; GList *l; GtkWindow *from_window = NULL; app = GTK_APPLICATION (g_application_get_default ()); windows_list = gtk_application_get_windows (app); for (l = windows_list; l != NULL; l = l->next) { GtkWindow *cur_window = GTK_WINDOW (l->data); if (cur_window != window && G_TYPE_CHECK_INSTANCE_TYPE (cur_window, window_type)) { from_window = cur_window; break; } } if (from_window != NULL) { copy_state (from_window, window); } else { restore_from_settings (window); } } /** * tepl_window_state_init: * @window: a #GtkWindow. * @settings: a #GSettings object. * @window_type: the type of #GtkWindow. * * When creating a new #GtkWindow, you can call this function to initialize some * of its state. Then things will be taken care of to remember the state. * * The provided #GSettings object must have at least these keys: * - `"maximized"` of type boolean. * - `"width"` of type integer. * - `"height"` of type integer. * * The @window_type (for example a subclass of #GtkApplicationWindow for the * main window) permits to use this utility for different types of windows. Each * window type will need its own set of #GSettings keys (in a different * sub-schema because the key names must be the same). * * A good place to call this function is in the GObject `init()` function. * * Since: 6.12 */ void tepl_window_state_init (GtkWindow *window, GSettings *settings, GType window_type) { WindowState *window_state; g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (G_IS_SETTINGS (settings)); g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (window, window_type)); window_state = g_object_get_data (G_OBJECT (window), WINDOW_STATE_KEY); g_return_if_fail (window_state == NULL); window_state = window_state_new (settings); g_object_set_data_full (G_OBJECT (window), WINDOW_STATE_KEY, window_state, (GDestroyNotify) window_state_free); g_signal_connect (window, "delete-event", G_CALLBACK (delete_event_cb), NULL); g_signal_connect (window, "size-allocate", G_CALLBACK (size_allocate_cb), NULL); setup_state (window, window_type); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl-window-state.h000066400000000000000000000007461526404732400267270ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_WINDOW_STATE_H #define TEPL_WINDOW_STATE_H #if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION) #error "Only can be included directly." #endif #include G_BEGIN_DECLS G_MODULE_EXPORT void tepl_window_state_init (GtkWindow *window, GSettings *settings, GType window_type); G_END_DECLS #endif /* TEPL_WINDOW_STATE_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tepl/tepl.h000066400000000000000000000042021526404732400242730ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_H #define TEPL_H #define TEPL_H_INSIDE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #undef TEPL_H_INSIDE #endif /* TEPL_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/000077500000000000000000000000001526404732400233565ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/000077500000000000000000000000001526404732400270335ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/meson.build000066400000000000000000000013361526404732400312000ustar00rootroot00000000000000interactive_tests = [ # executable name, sources ['test-fold-region', 'test-fold-region.c'], ['test-language-chooser-dialog', 'test-language-chooser-dialog.c'], ['test-language-chooser-widget', 'test-language-chooser-widget.c'], ['test-panel-notebook', 'test-panel-notebook.c'], ['test-panel-switcher-menu', 'test-panel-switcher-menu.c'], ['test-space-drawer-prefs', 'test-space-drawer-prefs.c'], ['test-status-menu-button', 'test-status-menu-button.c'], ['test-tab', 'test-tab.c'], ['test-gutter-renderer-folds', ['test-gutter-renderer-folds.c', 'tepl-gutter-renderer-folds-sub.c']], ] foreach test : interactive_tests executable( test[0], test[1], dependencies: TEPL_STATIC_DEP ) endforeach tepl-gutter-renderer-folds-sub.c000066400000000000000000000062331526404732400351000ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-gutter-renderer-folds-sub.h" G_DEFINE_TYPE (TeplGutterRendererFoldsSub, tepl_gutter_renderer_folds_sub, TEPL_TYPE_GUTTER_RENDERER_FOLDS) static void tepl_gutter_renderer_folds_sub_draw (GtkSourceGutterRenderer *renderer, cairo_t *cr, GdkRectangle *background_area, GdkRectangle *cell_area, GtkTextIter *start, GtkTextIter *end, GtkSourceGutterRendererState state) { gint line_num; TeplGutterRendererFoldsState folding_state; line_num = gtk_text_iter_get_line (start); if (line_num == 0) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_START_FOLDED; } else if (line_num == 1) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_START_OPENED; } else if (line_num < 5) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE; } else if (line_num == 5) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_END; } else if (line_num == 6) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_NONE; } else if (line_num == 7) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_START_OPENED; } else if (line_num == 8) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE; } else if (line_num == 9) { folding_state = (TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE | TEPL_GUTTER_RENDERER_FOLDS_STATE_START_OPENED); } else if (line_num < 12) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE; } else if (line_num == 12) { folding_state = (TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE | TEPL_GUTTER_RENDERER_FOLDS_STATE_END); } else if (line_num == 13) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE; } else if (line_num == 14) { folding_state = (TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE | TEPL_GUTTER_RENDERER_FOLDS_STATE_START_FOLDED); } else if (line_num == 15) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_CONTINUE; } else if (line_num == 16) { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_END; } else { folding_state = TEPL_GUTTER_RENDERER_FOLDS_STATE_NONE; } tepl_gutter_renderer_folds_set_state (TEPL_GUTTER_RENDERER_FOLDS (renderer), folding_state); if (GTK_SOURCE_GUTTER_RENDERER_CLASS (tepl_gutter_renderer_folds_sub_parent_class)->draw != NULL) { GTK_SOURCE_GUTTER_RENDERER_CLASS (tepl_gutter_renderer_folds_sub_parent_class)->draw (renderer, cr, background_area, cell_area, start, end, state); } } static void tepl_gutter_renderer_folds_sub_class_init (TeplGutterRendererFoldsSubClass *klass) { GtkSourceGutterRendererClass *renderer_class = GTK_SOURCE_GUTTER_RENDERER_CLASS (klass); renderer_class->draw = tepl_gutter_renderer_folds_sub_draw; } static void tepl_gutter_renderer_folds_sub_init (TeplGutterRendererFoldsSub *self) { } GtkSourceGutterRenderer * tepl_gutter_renderer_folds_sub_new (void) { return g_object_new (TEPL_TYPE_GUTTER_RENDERER_FOLDS_SUB, NULL); } tepl-gutter-renderer-folds-sub.h000066400000000000000000000031661526404732400351070ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_GUTTER_RENDERER_FOLDS_SUB_H #define TEPL_GUTTER_RENDERER_FOLDS_SUB_H #include #include #include G_BEGIN_DECLS #define TEPL_TYPE_GUTTER_RENDERER_FOLDS_SUB (tepl_gutter_renderer_folds_sub_get_type ()) #define TEPL_GUTTER_RENDERER_FOLDS_SUB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_GUTTER_RENDERER_FOLDS_SUB, TeplGutterRendererFoldsSub)) #define TEPL_GUTTER_RENDERER_FOLDS_SUB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_GUTTER_RENDERER_FOLDS_SUB, TeplGutterRendererFoldsSubClass)) #define TEPL_IS_GUTTER_RENDERER_FOLDS_SUB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_GUTTER_RENDERER_FOLDS_SUB)) #define TEPL_IS_GUTTER_RENDERER_FOLDS_SUB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_GUTTER_RENDERER_FOLDS_SUB)) #define TEPL_GUTTER_RENDERER_FOLDS_SUB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_GUTTER_RENDERER_FOLDS_SUB, TeplGutterRendererFoldsSubClass)) typedef struct _TeplGutterRendererFoldsSubClass TeplGutterRendererFoldsSubClass; typedef struct _TeplGutterRendererFoldsSub TeplGutterRendererFoldsSub; struct _TeplGutterRendererFoldsSub { TeplGutterRendererFolds parent_instance; }; struct _TeplGutterRendererFoldsSubClass { TeplGutterRendererFoldsClass parent_class; }; GType tepl_gutter_renderer_folds_sub_get_type (void); GtkSourceGutterRenderer * tepl_gutter_renderer_folds_sub_new (void); G_END_DECLS #endif /* TEPL_GUTTER_RENDERER_FOLDS_SUB_H */ test-fold-region.c000066400000000000000000000026371526404732400323120ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static GtkWidget * create_view (void) { GtkWidget *view; GtkTextBuffer *buffer; TeplFoldRegion *fold_region; GtkTextIter start_iter; GtkTextIter end_iter; view = tepl_view_new (); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_insert_at_cursor (buffer, "Line0\nLine1\nLine2\nLine3\nLine4\nLine5", -1); gtk_text_buffer_get_iter_at_line (buffer, &start_iter, 1); gtk_text_buffer_get_iter_at_line (buffer, &end_iter, 3); /* FIXME: fold_region must be unreffed on exit. */ fold_region = tepl_fold_region_new (buffer, &start_iter, &end_iter); tepl_fold_region_set_folded (fold_region, TRUE); return view; } int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *scrolled_window; tepl_init (); gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 500, 500); g_signal_connect (window, "destroy", gtk_main_quit, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_window), create_view ()); gtk_container_add (GTK_CONTAINER (window), scrolled_window); gtk_widget_show_all (window); gtk_main (); tepl_finalize (); return 0; } test-gutter-renderer-folds.c000066400000000000000000000024431526404732400343230ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-gutter-renderer-folds-sub.h" static GtkWidget * create_view (void) { GtkWidget *view; GtkTextBuffer *buffer; GtkSourceGutter *gutter; GtkSourceGutterRenderer *renderer; view = tepl_view_new (); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_insert_at_cursor (buffer, "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" "11\n12\n13\n14\n15\n16\n17\n18\n19", -1); gutter = gtk_source_view_get_gutter (GTK_SOURCE_VIEW (view), GTK_TEXT_WINDOW_LEFT); renderer = tepl_gutter_renderer_folds_sub_new (); gtk_source_gutter_insert (gutter, renderer, 0); return view; } int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *scrolled_window; tepl_init (); gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 500, 500); g_signal_connect (window, "destroy", gtk_main_quit, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_window), create_view ()); gtk_container_add (GTK_CONTAINER (window), scrolled_window); gtk_widget_show_all (window); gtk_main (); tepl_finalize (); return 0; } test-language-chooser-dialog.c000066400000000000000000000031571526404732400345630ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include static void select_random_language (TeplLanguageChooserDialog *dialog) { GtkSourceLanguageManager *manager; GtkSourceLanguage *language; manager = gtk_source_language_manager_get_default (); // xml has been picked at random. language = gtk_source_language_manager_get_language (manager, "xml"); tepl_language_chooser_select_language (TEPL_LANGUAGE_CHOOSER (dialog), language); } static void language_activated_cb (TeplLanguageChooserDialog *dialog, GtkSourceLanguage *language, gpointer user_data) { if (language != NULL) { g_message ("Language activated: %s", gtk_source_language_get_id (language)); } else { g_message ("Plain Text activated."); } gtk_widget_destroy (GTK_WIDGET (dialog)); } static void dialog_response_after_cb (GtkDialog *dialog, gint response_id, gpointer user_data) { gtk_widget_destroy (GTK_WIDGET (dialog)); } int main (int argc, char **argv) { TeplLanguageChooserDialog *dialog; gtk_init (&argc, &argv); dialog = tepl_language_chooser_dialog_new (NULL); select_random_language (dialog); g_signal_connect (dialog, "language-activated", G_CALLBACK (language_activated_cb), NULL); g_signal_connect_after (dialog, "response", G_CALLBACK (dialog_response_after_cb), NULL); g_signal_connect (dialog, "destroy", gtk_main_quit, NULL); gtk_widget_show (GTK_WIDGET (dialog)); gtk_main (); return EXIT_SUCCESS; } test-language-chooser-widget.c000066400000000000000000000027161526404732400346070ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include static void language_activated_cb (TeplLanguageChooser *chooser, GtkSourceLanguage *language, gpointer user_data) { if (language != NULL) { g_message ("Language activated: %s", gtk_source_language_get_id (language)); } else { g_message ("Plain Text activated."); } } static void select_random_language (TeplLanguageChooserWidget *chooser_widget) { GtkSourceLanguageManager *manager; GtkSourceLanguage *language; manager = gtk_source_language_manager_get_default (); // html has been picked at random. language = gtk_source_language_manager_get_language (manager, "html"); tepl_language_chooser_select_language (TEPL_LANGUAGE_CHOOSER (chooser_widget), language); } int main (int argc, char **argv) { GtkWidget *window; TeplLanguageChooserWidget *chooser_widget; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", gtk_main_quit, NULL); chooser_widget = tepl_language_chooser_widget_new (); select_random_language (chooser_widget); gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (chooser_widget)); g_signal_connect (chooser_widget, "language-activated", G_CALLBACK (language_activated_cb), NULL); gtk_widget_show_all (window); gtk_main (); return EXIT_SUCCESS; } test-panel-notebook.c000066400000000000000000000031751526404732400330200ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include static TeplPanelSimple * create_panel_simple (void) { TeplPanelSimple *panel_simple; GtkWidget *label; TeplPanelItem *item; panel_simple = tepl_panel_simple_new (); label = gtk_label_new ("Widget 1"); item = tepl_panel_item_new (label, "name1", "Title 1", NULL, 0); tepl_panel_add (TEPL_PANEL (panel_simple), item); g_object_unref (item); label = gtk_label_new ("Widget 2"); item = tepl_panel_item_new (label, "name2", "Title 2", NULL, 0); tepl_panel_add (TEPL_PANEL (panel_simple), item); g_object_unref (item); return panel_simple; } static GtkNotebook * create_notebook (void) { GtkNotebook *notebook; notebook = GTK_NOTEBOOK (gtk_notebook_new ()); gtk_notebook_set_tab_pos (notebook, GTK_POS_BOTTOM); return notebook; } int main (int argc, char **argv) { GtkWidget *window; TeplPanelSimple *panel_simple; GtkNotebook *notebook; TeplPanelNotebook *panel_notebook; tepl_init (); gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); panel_simple = create_panel_simple (); notebook = create_notebook (); panel_notebook = tepl_panel_notebook_new (panel_simple, notebook); g_object_unref (panel_simple); gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (notebook)); gtk_widget_show_all (window); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_main (); g_object_unref (panel_notebook); tepl_finalize (); return EXIT_SUCCESS; } test-panel-switcher-menu.c000066400000000000000000000040411526404732400337630ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2023 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include static TeplPanelStack * create_panel_stack (void) { TeplPanelStack *panel_stack; TeplPanelSimple *panel_simple; GtkWidget *label; TeplPanelItem *item; panel_stack = tepl_panel_stack_new (NULL, NULL); panel_simple = tepl_panel_stack_get_panel_simple (panel_stack); label = gtk_label_new ("Widget 1"); item = tepl_panel_item_new (label, "name1", "Title 1", NULL, 0); tepl_panel_add (TEPL_PANEL (panel_simple), item); tepl_panel_set_active (TEPL_PANEL (panel_simple), item); g_object_unref (item); label = gtk_label_new ("Widget 2"); item = tepl_panel_item_new (label, "name2", "Title 2", NULL, 0); tepl_panel_add (TEPL_PANEL (panel_simple), item); g_object_unref (item); gtk_widget_show (GTK_WIDGET (tepl_panel_stack_get_stack (panel_stack))); return panel_stack; } int main (int argc, char **argv) { GtkWidget *window; TeplPanelStack *panel_stack; GtkHeaderBar *headerbar; TeplPanelSwitcherMenu *switcher_menu; tepl_init (); gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); panel_stack = create_panel_stack (); gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (tepl_panel_stack_get_stack (panel_stack))); headerbar = GTK_HEADER_BAR (gtk_header_bar_new ()); gtk_header_bar_set_show_close_button (headerbar, TRUE); gtk_header_bar_set_title (headerbar, "TeplPanelSwitcherMenu Test"); switcher_menu = tepl_panel_switcher_menu_new (tepl_panel_stack_get_panel_simple (panel_stack)); gtk_header_bar_pack_start (headerbar, GTK_WIDGET (switcher_menu)); gtk_widget_show_all (GTK_WIDGET (headerbar)); gtk_window_set_titlebar (GTK_WINDOW (window), GTK_WIDGET (headerbar)); gtk_widget_show (window); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_main (); g_object_unref (panel_stack); tepl_finalize (); return EXIT_SUCCESS; } test-space-drawer-prefs.c000066400000000000000000000076071526404732400336010ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include typedef struct { GtkWindow *window; TeplSpaceDrawerPrefs *space_drawer_prefs; GtkDialog *dialog; TeplTab *tab; } SmallTest; static void init_space_drawer_prefs (SmallTest *self) { g_assert (self->space_drawer_prefs == NULL); self->space_drawer_prefs = tepl_space_drawer_prefs_new (); gtk_widget_show (GTK_WIDGET (self->space_drawer_prefs)); } static void init_dialog (SmallTest *self) { GtkWidget *content_area; g_assert (self->dialog == NULL); g_assert (self->window != NULL); g_assert (self->space_drawer_prefs != NULL); self->dialog = GTK_DIALOG (gtk_dialog_new_with_buttons ("Space Drawing Preferences", self->window, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR, NULL, NULL)); content_area = gtk_dialog_get_content_area (self->dialog); gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET (self->space_drawer_prefs)); g_signal_connect (self->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); } static void init_tab (SmallTest *self) { GtkSourceView *view; GtkSourceSpaceDrawer *space_drawer; GtkTextBuffer *buffer; g_assert (self->tab == NULL); self->tab = tepl_tab_new (); gtk_widget_show (GTK_WIDGET (self->tab)); view = GTK_SOURCE_VIEW (tepl_tab_get_view (self->tab)); gtk_text_view_set_monospace (GTK_TEXT_VIEW (view), TRUE); space_drawer = gtk_source_view_get_space_drawer (view); gtk_source_space_drawer_set_enable_matrix (space_drawer, TRUE); buffer = GTK_TEXT_BUFFER (tepl_tab_get_buffer (self->tab)); gtk_text_buffer_set_text (buffer, "\tTab\tTab\t\n" " Space Space \n" "\xC2\xA0No-Break Space\xC2\xA0No-Break Space\xC2\xA0\n" "\xE2\x80\xAFNarrow No-Break Space\xE2\x80\xAFNarrow No-Break Space\xE2\x80\xAF", -1); } static void button_clicked_cb (GtkButton *button, SmallTest *self) { gtk_widget_show (GTK_WIDGET (self->dialog)); } static GtkWidget * create_button (SmallTest *self) { GtkWidget *button; button = gtk_button_new_with_label ("Space drawing preferences"); g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), self); return button; } static GtkGrid * create_main_vgrid (SmallTest *self) { GtkGrid *main_vgrid; main_vgrid = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (main_vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (main_vgrid, 6); g_object_set (main_vgrid, "margin", 6, NULL); gtk_container_add (GTK_CONTAINER (main_vgrid), create_button (self)); gtk_container_add (GTK_CONTAINER (main_vgrid), GTK_WIDGET (self->tab)); return main_vgrid; } static void bind_matrix_properties (SmallTest *self) { GtkSourceSpaceDrawer *prefs_space_drawer; GtkSourceView *view; GtkSourceSpaceDrawer *view_space_drawer; prefs_space_drawer = tepl_space_drawer_prefs_get_space_drawer (self->space_drawer_prefs); view = GTK_SOURCE_VIEW (tepl_tab_get_view (self->tab)); view_space_drawer = gtk_source_view_get_space_drawer (view); g_object_bind_property (prefs_space_drawer, "matrix", view_space_drawer, "matrix", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); } static void init_window (SmallTest *self) { self->window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); gtk_window_set_default_size (self->window, 500, 500); g_signal_connect (self->window, "destroy", gtk_main_quit, NULL); init_space_drawer_prefs (self); init_dialog (self); init_tab (self); bind_matrix_properties (self); gtk_container_add (GTK_CONTAINER (self->window), GTK_WIDGET (create_main_vgrid (self))); gtk_widget_show_all (GTK_WIDGET (self->window)); } int main (int argc, char **argv) { SmallTest self = { NULL }; gtk_init (&argc, &argv); init_window (&self); gtk_main (); return EXIT_SUCCESS; } test-status-menu-button.c000066400000000000000000000057371526404732400337070ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/* SPDX-FileCopyrightText: 2023 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include static TeplStatusMenuButton * create_status_button (void) { TeplStatusMenuButton *status_button; GtkWidget *popover_label; GtkWidget *popover; status_button = tepl_status_menu_button_new (); tepl_status_menu_button_set_label_text (status_button, "Text"); popover_label = gtk_label_new ("Popover"); gtk_widget_show (popover_label); popover = gtk_popover_new (GTK_WIDGET (status_button)); gtk_container_add (GTK_CONTAINER (popover), popover_label); gtk_menu_button_set_popover (GTK_MENU_BUTTON (status_button), popover); return status_button; } static GtkWidget * create_statusbar (void) { GtkStatusbar *statusbar; statusbar = GTK_STATUSBAR (gtk_statusbar_new ()); tepl_utils_setup_statusbar (statusbar); gtk_statusbar_push (statusbar, gtk_statusbar_get_context_id (statusbar, "foo"), "Status bar"); gtk_box_pack_end (GTK_BOX (statusbar), GTK_WIDGET (create_status_button ()), FALSE, FALSE, 0); return GTK_WIDGET (statusbar); } static GtkFrame * create_frame (void) { GtkFrame *frame; GtkCssProvider *css_provider; GtkStyleContext *style_context; GError *error = NULL; /* To remove unwanted borders. * Keep the one at the bottom, to see where the statusbar starts. */ const gchar *frame_border_css = "frame border {\n" " border-top: none;\n" " border-left: none;\n" " border-right: none;\n" "}\n"; frame = GTK_FRAME (gtk_frame_new (NULL)); css_provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (css_provider, frame_border_css, -1, &error); if (error != NULL) { g_warning ("CSS error: %s", error->message); g_clear_error (&error); } style_context = gtk_widget_get_style_context (GTK_WIDGET (frame)); gtk_style_context_add_provider (style_context, GTK_STYLE_PROVIDER (css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (css_provider); return frame; } static GtkWidget * create_content (void) { GtkWidget *content; GtkFrame *frame; content= gtk_label_new ("Content"); gtk_widget_set_hexpand (content, TRUE); gtk_widget_set_vexpand (content, TRUE); frame = create_frame (); gtk_container_add (GTK_CONTAINER (frame), content); return GTK_WIDGET (frame); } int main (int argc, char **argv) { GtkWidget *window; GtkGrid *vgrid; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); g_signal_connect (window, "destroy", gtk_main_quit, NULL); vgrid = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (vgrid), create_content ()); gtk_container_add (GTK_CONTAINER (vgrid), create_statusbar ()); gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (vgrid)); gtk_widget_show_all (window); gtk_main (); return EXIT_SUCCESS; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/interactive-tests/test-tab.c000066400000000000000000000167351526404732400307360ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include static void info_bar_response_cb (GtkInfoBar *info_bar, gint response_id, gpointer user_data) { gtk_widget_destroy (GTK_WIDGET (info_bar)); } static void basic_cb (GtkButton *button, TeplTab *tab) { TeplInfoBar *info_bar; GtkWidget *entry; info_bar = tepl_info_bar_new_simple (GTK_MESSAGE_WARNING, "Primary message.", "Secondary message."); entry = gtk_entry_new (); gtk_widget_show (entry); tepl_info_bar_add_content_widget (info_bar, entry, TEPL_INFO_BAR_LOCATION_ALONGSIDE_ICON); //tepl_info_bar_add_content_widget (info_bar, entry, TEPL_INFO_BAR_LOCATION_BELOW_ICON); tepl_info_bar_setup_close_button (info_bar); // Test changing the :message-type property. Is the icon correctly // updated? gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_QUESTION); // Test setting the :icon-name property. It should have a higher // priority. tepl_info_bar_set_icon_name (info_bar, "document-print"); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); } static void progress_cb (GtkButton *button, TeplTab *tab) { TeplProgressInfoBar *info_bar; info_bar = tepl_progress_info_bar_new ("document-save", "File loading... The full and very long path is: " "/home/seb/a/very/long/path/like/this/is/beautiful" "/but/is/it/correctly/wrapped/in/the/info/bar/that" "/is/the/question", TRUE); tepl_progress_info_bar_set_fraction (info_bar, 0.3); g_signal_connect (info_bar, "response", G_CALLBACK (info_bar_response_cb), NULL); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); } static void already_open_cb (GtkButton *button, TeplTab *tab) { GFile *location; TeplInfoBar *info_bar; location = g_file_new_for_path ("/home/user/file"); info_bar = tepl_io_error_info_bar_file_already_open (location); g_signal_connect (info_bar, "response", G_CALLBACK (info_bar_response_cb), NULL); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); g_object_unref (location); } static void cant_create_backup_cb (GtkButton *button, TeplTab *tab) { GFile *location; GError *error; TeplInfoBar *info_bar; location = g_file_new_for_path ("/home/user/file"); error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANT_CREATE_BACKUP, "error message"); info_bar = tepl_io_error_info_bar_cant_create_backup (location, error); g_signal_connect (info_bar, "response", G_CALLBACK (info_bar_response_cb), NULL); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); g_object_unref (location); g_error_free (error); } static void externally_modified_cb (GtkButton *button, TeplTab *tab) { GFile *location; TeplInfoBar *info_bar; location = g_file_new_for_path ("/home/user/file"); info_bar = tepl_io_error_info_bar_externally_modified (location, TRUE); g_signal_connect (info_bar, "response", G_CALLBACK (info_bar_response_cb), NULL); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); g_object_unref (location); } static void saving_externally_modified_cb (GtkButton *button, TeplTab *tab) { GFile *location; TeplInfoBar *info_bar; location = g_file_new_for_path ("/home/user/file"); info_bar = tepl_io_error_info_bar_saving_externally_modified (location); g_signal_connect (info_bar, "response", G_CALLBACK (info_bar_response_cb), NULL); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); g_object_unref (location); } static void invalid_characters_cb (GtkButton *button, TeplTab *tab) { GFile *location; TeplInfoBar *info_bar; location = g_file_new_for_path ("/home/user/file"); info_bar = tepl_io_error_info_bar_invalid_characters (location); g_signal_connect (info_bar, "response", G_CALLBACK (info_bar_response_cb), NULL); tepl_tab_add_info_bar (tab, GTK_INFO_BAR (info_bar)); gtk_widget_show (GTK_WIDGET (info_bar)); g_object_unref (location); } static GtkWidget * create_side_panel (TeplTab *tab) { GtkGrid *vgrid; GtkWidget *basic; GtkWidget *progress; GtkWidget *already_open; GtkWidget *cant_create_backup; GtkWidget *externally_modified; GtkWidget *saving_externally_modified; GtkWidget *invalid_characters; vgrid = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (vgrid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (vgrid, 6); basic = gtk_button_new_with_label ("Basic"); gtk_container_add (GTK_CONTAINER (vgrid), basic); g_signal_connect_object (basic, "clicked", G_CALLBACK (basic_cb), tab, 0); progress = gtk_button_new_with_label ("Progress"); gtk_container_add (GTK_CONTAINER (vgrid), progress); g_signal_connect_object (progress, "clicked", G_CALLBACK (progress_cb), tab, 0); already_open = gtk_button_new_with_label ("Already open"); gtk_container_add (GTK_CONTAINER (vgrid), already_open); g_signal_connect_object (already_open, "clicked", G_CALLBACK (already_open_cb), tab, 0); cant_create_backup = gtk_button_new_with_label ("Can't create backup"); gtk_container_add (GTK_CONTAINER (vgrid), cant_create_backup); g_signal_connect_object (cant_create_backup, "clicked", G_CALLBACK (cant_create_backup_cb), tab, 0); externally_modified = gtk_button_new_with_label ("Externally modified"); gtk_container_add (GTK_CONTAINER (vgrid), externally_modified); g_signal_connect_object (externally_modified, "clicked", G_CALLBACK (externally_modified_cb), tab, 0); saving_externally_modified = gtk_button_new_with_label ("Saving externally modified"); gtk_container_add (GTK_CONTAINER (vgrid), saving_externally_modified); g_signal_connect_object (saving_externally_modified, "clicked", G_CALLBACK (saving_externally_modified_cb), tab, 0); invalid_characters = gtk_button_new_with_label ("Invalid characters"); gtk_container_add (GTK_CONTAINER (vgrid), invalid_characters); g_signal_connect_object (invalid_characters, "clicked", G_CALLBACK (invalid_characters_cb), tab, 0); return GTK_WIDGET (vgrid); } static GtkWidget * create_window_content (void) { GtkGrid *hgrid; TeplTab *tab; GtkWidget *side_panel; hgrid = GTK_GRID (gtk_grid_new ()); gtk_orientable_set_orientation (GTK_ORIENTABLE (hgrid), GTK_ORIENTATION_HORIZONTAL); gtk_grid_set_column_spacing (hgrid, 6); g_object_set (hgrid, "margin", 6, NULL); tab = tepl_tab_new (); side_panel = create_side_panel (tab); gtk_container_add (GTK_CONTAINER (hgrid), side_panel); gtk_container_add (GTK_CONTAINER (hgrid), GTK_WIDGET (tab)); gtk_widget_show_all (GTK_WIDGET (hgrid)); return GTK_WIDGET (hgrid); } int main (int argc, char **argv) { GtkWidget *window; tepl_init (); gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 800, 600); gtk_container_add (GTK_CONTAINER (window), create_window_content ()); gtk_widget_show (window); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_main (); tepl_finalize (); return EXIT_SUCCESS; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/meson.build000066400000000000000000000001071526404732400255160ustar00rootroot00000000000000subdir('interactive-tests') subdir('other-tests') subdir('unit-tests') libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/other-tests/000077500000000000000000000000001526404732400256375ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/other-tests/meson.build000066400000000000000000000010111526404732400277720ustar00rootroot00000000000000other_tests = [ 'test-utils-gsettings', ] foreach test_name : other_tests executable( test_name, test_name + '.c', dependencies: TEPL_STATIC_DEP, ) endforeach # Other tests requiring additional configuration gsv_lang_dir = dependency('libgedit-gtksourceview-300').get_variable(pkgconfig: 'prefix') / 'share/libgedit-gtksourceview-300/language-specs' executable( 'test-code-comment', 'test-code-comment.c', dependencies: TEPL_STATIC_DEP, c_args: '-DGSV_LANG_DIR="@0@"'.format(gsv_lang_dir), ) libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/other-tests/test-code-comment.c000066400000000000000000000043301526404732400313320ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2025 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static gboolean metadata_is_present (GtkSourceLanguage *language) { return (gtk_source_language_get_metadata (language, "line-comment-start") != NULL || gtk_source_language_get_metadata (language, "block-comment-start") != NULL || gtk_source_language_get_metadata (language, "block-comment-end") != NULL); } static void test_language (GtkSourceLanguage *language) { GtkSourceView *view; GtkSourceBuffer *buffer; TeplCodeCommentView *code_comment_view; view = GTK_SOURCE_VIEW (gtk_source_view_new ()); g_object_ref_sink (view); buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); gtk_source_buffer_set_language (buffer, language); code_comment_view = tepl_code_comment_view_new (view); if (tepl_code_comment_view_code_comment_is_supported (code_comment_view)) { g_print ("ok"); } else if (metadata_is_present (language)) { g_print ("WARNING: metadata is present but not supported!"); } else { g_print ("ok, but metadata is not present."); } g_object_unref (view); g_object_unref (code_comment_view); } static void test_all_languages (const gchar *directory) { GtkSourceLanguageManager *language_manager; const gchar *search_path[2]; const gchar * const *language_ids; gint i; language_manager = gtk_source_language_manager_new (); search_path[0] = directory; search_path[1] = NULL; gtk_source_language_manager_set_search_path (language_manager, (gchar **)search_path); language_ids = gtk_source_language_manager_get_language_ids (language_manager); for (i = 0; language_ids != NULL && language_ids[i] != NULL; i++) { const gchar *cur_language_id = language_ids[i]; GtkSourceLanguage *cur_language; cur_language = gtk_source_language_manager_get_language (language_manager, cur_language_id); if (!gtk_source_language_get_hidden (cur_language)) { g_print ("%s: ", cur_language_id); test_language (cur_language); g_print ("\n"); } } g_object_unref (language_manager); } int main (int argc, char **argv) { tepl_init (); gtk_init (&argc, &argv); test_all_languages (GSV_LANG_DIR); tepl_finalize (); return EXIT_SUCCESS; } test-utils-gsettings.c000066400000000000000000000025161526404732400320520ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/other-tests/* SPDX-FileCopyrightText: 2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include #define SETTINGS_DESKTOP_INTERFACE "org.gnome.desktop.interface" #define SETTINGS_NOT_FOUND "one.this.not.probably" #define SETTINGS_KEY_MONOSPACE_FONT_NAME "monospace-font-name" #define SETTINGS_KEY_NOT_FOUND "probably-not-found" static void print_can_use_schema (const gchar *schema_id) { gboolean can_use; can_use = tepl_utils_can_use_gsettings_schema (schema_id); g_print ("Can use '%s': %s\n", schema_id, can_use ? "yes" : "no"); } static void print_can_use_key (const gchar *schema_id, const gchar *key) { GSettings *settings; gboolean can_use; settings = g_settings_new (schema_id); can_use = tepl_utils_can_use_gsettings_key (settings, key); g_print ("Can use '%s' -> key '%s': %s\n", schema_id, key, can_use ? "yes" : "no"); } int main (void) { print_can_use_schema (SETTINGS_DESKTOP_INTERFACE); print_can_use_schema (SETTINGS_NOT_FOUND); g_print ("\n"); print_can_use_key (SETTINGS_DESKTOP_INTERFACE, SETTINGS_KEY_MONOSPACE_FONT_NAME); print_can_use_key (SETTINGS_DESKTOP_INTERFACE, SETTINGS_KEY_NOT_FOUND); // To test that it actually crashes: //print_can_use_key (SETTINGS_NOT_FOUND, SETTINGS_KEY_NOT_FOUND); return EXIT_SUCCESS; } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/000077500000000000000000000000001526404732400254755ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/meson.build000066400000000000000000000010401526404732400276320ustar00rootroot00000000000000unit_tests = [ 'test-file', 'test-file-loader', 'test-file-saver', 'test-fold-region', 'test-icu', 'test-info-bar', 'test-metadata', 'test-metadata-manager', 'test-notebook', 'test-panel-item', 'test-panel-simple', 'test-utils', 'test-view', ] foreach test_name : unit_tests test_exe = executable( test_name, [test_name + '.c', 'tepl-test-utils.c'], dependencies: TEPL_STATIC_DEP, c_args: '-DUNIT_TESTS_SOURCE_DIR="@0@"'.format(meson.current_source_dir()) ) test(test_name, test_exe) endforeach libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/tepl-test-utils.c000066400000000000000000000043231526404732400307220ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl-test-utils.h" #include /* Common utility functions for the unit tests. */ void _tepl_test_utils_set_file_content (GFile *file, const gchar *content) { GError *error = NULL; g_file_replace_contents (file, content, strlen (content), NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, &error); g_assert_no_error (error); } gchar * _tepl_test_utils_get_file_content (GFile *file) { GError *error = NULL; gchar *file_content = NULL; g_file_load_contents (file, NULL, &file_content, NULL, NULL, &error); g_assert_no_error (error); g_assert_true (file_content != NULL); return file_content; } void _tepl_test_utils_check_file_content (GFile *file, const gchar *expected_file_content) { gchar *received_file_content; received_file_content = _tepl_test_utils_get_file_content (file); g_assert_true (g_str_equal (received_file_content, expected_file_content)); g_free (received_file_content); } void _tepl_test_utils_check_equal_files_content (GFile *file1, GFile *file2) { gchar *file1_content = _tepl_test_utils_get_file_content (file1); gchar *file2_content = _tepl_test_utils_get_file_content (file2); g_assert_true (g_str_equal (file1_content, file2_content)); g_free (file1_content); g_free (file2_content); } struct _TeplWaitSignalData { guint signal_received : 1; guint nested_main_loop : 1; }; static void wait_signal_cb (TeplWaitSignalData *data) { data->signal_received = TRUE; if (data->nested_main_loop) { gtk_main_quit (); } } TeplWaitSignalData * _tepl_test_utils_wait_signal_setup (GObject *object, const gchar *detailed_signal_name) { TeplWaitSignalData *data; data = g_new0 (TeplWaitSignalData, 1); data->signal_received = FALSE; data->nested_main_loop = FALSE; g_signal_connect_swapped (object, detailed_signal_name, G_CALLBACK (wait_signal_cb), data); return data; } void _tepl_test_utils_wait_signal (TeplWaitSignalData *data) { if (!data->signal_received) { data->nested_main_loop = TRUE; gtk_main (); } g_free (data); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/tepl-test-utils.h000066400000000000000000000015211526404732400307240ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #ifndef TEPL_TEST_UTILS_H #define TEPL_TEST_UTILS_H #include G_BEGIN_DECLS typedef struct _TeplWaitSignalData TeplWaitSignalData; void _tepl_test_utils_set_file_content (GFile *file, const gchar *content); gchar * _tepl_test_utils_get_file_content (GFile *file); void _tepl_test_utils_check_file_content (GFile *file, const gchar *expected_file_content); void _tepl_test_utils_check_equal_files_content (GFile *file1, GFile *file2); TeplWaitSignalData * _tepl_test_utils_wait_signal_setup (GObject *object, const gchar *detailed_signal_name); void _tepl_test_utils_wait_signal (TeplWaitSignalData *data); G_END_DECLS #endif /* TEPL_TEST_UTILS_H */ libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-file-loader.c000066400000000000000000000110001526404732400307710ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include #include "tepl-test-utils.h" static GFile * get_tmp_location (void) { return g_file_new_build_filename (g_get_tmp_dir (), "tepl-file-loader-test", NULL); } static void load_sync_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplFileLoader *loader = TEPL_FILE_LOADER (source_object); GError **error = user_data; tepl_file_loader_load_finish (loader, result, error); gtk_main_quit (); } static void load_sync (TeplFileLoader *loader, GError **error) { tepl_file_loader_load_async (loader, G_PRIORITY_DEFAULT, NULL, load_sync_cb, error); gtk_main (); } static void load_sync_expect_no_error (TeplFileLoader *loader) { GError *error = NULL; load_sync (loader, &error); g_assert_no_error (error); } /* Useful to check that the buffer has been reset after the load. */ static TeplBuffer * create_buffer (void) { TeplBuffer *buffer = tepl_buffer_new (); GtkTextBuffer *text_buffer = GTK_TEXT_BUFFER (buffer); GtkSourceBuffer *gsv_buffer = GTK_SOURCE_BUFFER (buffer); gtk_text_buffer_set_text (text_buffer, "Initial content", -1); g_assert_true (gtk_source_buffer_can_undo (gsv_buffer)); return buffer; } static void check_buffer_state_after_load (TeplBuffer *buffer, const gchar *expected_content) { GtkTextBuffer *text_buffer = GTK_TEXT_BUFFER (buffer); GtkSourceBuffer *gsv_buffer = GTK_SOURCE_BUFFER (buffer); GtkTextIter start; GtkTextIter end; GtkTextIter selection_start; GtkTextIter selection_end; gchar *received_content; gtk_text_buffer_get_bounds (text_buffer, &start, &end); received_content = gtk_text_buffer_get_text (text_buffer, &start, &end, TRUE); g_assert_true (g_str_equal (received_content, expected_content)); g_free (received_content); g_assert_true (!gtk_text_buffer_get_modified (text_buffer)); g_assert_true (!gtk_source_buffer_can_undo (gsv_buffer)); g_assert_true (!gtk_source_buffer_can_redo (gsv_buffer)); gtk_text_buffer_get_selection_bounds (text_buffer, &selection_start, &selection_end); g_assert_true (gtk_text_iter_is_start (&selection_start)); g_assert_true (gtk_text_iter_is_start (&selection_end)); } static void test_properties (void) { TeplBuffer *buffer; TeplFile *file; GFile *location; TeplFileLoader *loader; buffer = tepl_buffer_new (); file = tepl_buffer_get_file (buffer); location = g_file_new_for_path ("location"); tepl_file_set_location (file, location); loader = tepl_file_loader_new (buffer, file); g_assert_true (tepl_file_loader_get_buffer (loader) == buffer); g_assert_true (tepl_file_loader_get_file (loader) == file); g_assert_true (tepl_file_loader_get_location (loader) == location); g_object_unref (buffer); g_object_unref (location); g_object_unref (loader); } static void test_non_existing_file (void) { TeplBuffer *buffer; TeplFile *file; GFile *location; TeplFileLoader *loader; GError *error = NULL; buffer = create_buffer (); file = tepl_buffer_get_file (buffer); location = get_tmp_location (); g_file_delete (location, NULL, &error); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { g_clear_error (&error); } g_assert_no_error (error); tepl_file_set_location (file, location); loader = tepl_file_loader_new (buffer, file); load_sync (loader, &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND); g_clear_error (&error); check_buffer_state_after_load (buffer, ""); g_object_unref (buffer); g_object_unref (location); g_object_unref (loader); } static void test_utf8_file (void) { TeplBuffer *buffer; TeplFile *file; GFile *location; const gchar *content; TeplFileLoader *loader; buffer = create_buffer (); file = tepl_buffer_get_file (buffer); location = get_tmp_location (); content = "Valid UTF-8: ÉÈßÇ"; _tepl_test_utils_set_file_content (location, content); tepl_file_set_location (file, location); loader = tepl_file_loader_new (buffer, file); load_sync_expect_no_error (loader); check_buffer_state_after_load (buffer, content); g_object_unref (buffer); g_object_unref (location); g_object_unref (loader); } int main (int argc, char **argv) { gtk_test_init (&argc, &argv); g_test_add_func ("/file_loader/properties", test_properties); g_test_add_func ("/file_loader/non_existing_file", test_non_existing_file); g_test_add_func ("/file_loader/utf8_file", test_utf8_file); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-file-saver.c000066400000000000000000000110561526404732400306560ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include "tepl-test-utils.h" static GFile * get_tmp_location (void) { return g_file_new_build_filename (g_get_tmp_dir (), "tepl-file-saver-test", NULL); } static GFile * get_tmp_backup_location (void) { return g_file_new_build_filename (g_get_tmp_dir (), "tepl-file-saver-test~", NULL); } static void save_sync_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplFileSaver *saver = TEPL_FILE_SAVER (source_object); gboolean ok; GError *error = NULL; ok = tepl_file_saver_save_finish (saver, result, &error); g_assert_true (ok); g_assert_no_error (error); gtk_main_quit (); } static void save_sync (TeplFileSaver *saver) { tepl_file_saver_save_async (saver, G_PRIORITY_DEFAULT, NULL, save_sync_cb, NULL); gtk_main (); } static void check_save_content (const gchar *content) { TeplBuffer *buffer; TeplFile *file; GFile *location; TeplFileSaver *saver; buffer = tepl_buffer_new (); gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), content, -1); file = tepl_file_new (); location = get_tmp_location (); saver = tepl_file_saver_new_with_target (buffer, file, location); save_sync (saver); _tepl_test_utils_check_file_content (location, content); g_object_unref (buffer); g_object_unref (file); g_object_unref (location); g_object_unref (saver); } static void test_basic (void) { check_save_content (""); check_save_content ("ho"); check_save_content ("several\nlines"); check_save_content ("several\nlines\n"); check_save_content ("UTF-8-Évo"); } static void test_backup (void) { TeplBuffer *buffer; TeplFile *file; GFile *location; GFile *backup_location; TeplFileSaver *saver; buffer = tepl_buffer_new (); gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), "contentA", -1); file = tepl_file_new (); location = get_tmp_location (); saver = tepl_file_saver_new_with_target (buffer, file, location); save_sync (saver); _tepl_test_utils_check_file_content (location, "contentA"); g_object_unref (saver); gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), "contentB", -1); saver = tepl_file_saver_new_with_target (buffer, file, location); tepl_file_saver_set_flags (saver, TEPL_FILE_SAVER_FLAGS_CREATE_BACKUP); save_sync (saver); _tepl_test_utils_check_file_content (location, "contentB"); g_object_unref (saver); backup_location = get_tmp_backup_location (); _tepl_test_utils_check_file_content (backup_location, "contentA"); g_object_unref (buffer); g_object_unref (file); g_object_unref (location); g_object_unref (backup_location); } static void test_properties (void) { TeplBuffer *buffer; GtkTextBuffer *text_buffer; TeplFile *file; GFile *location; TeplFileSaver *saver; buffer = tepl_buffer_new (); text_buffer = GTK_TEXT_BUFFER (buffer); file = tepl_file_new (); location = get_tmp_location (); saver = tepl_file_saver_new_with_target (buffer, file, location); g_assert_true (tepl_file_saver_get_buffer (saver) == buffer); g_assert_true (tepl_file_saver_get_file (saver) == file); g_assert_true (tepl_file_saver_get_location (saver) == location); g_assert_cmpint (tepl_file_saver_get_flags (saver), ==, TEPL_FILE_SAVER_FLAGS_NONE); g_object_unref (saver); tepl_file_set_location (file, location); saver = tepl_file_saver_new (buffer, file); g_assert_true (tepl_file_saver_get_buffer (saver) == buffer); g_assert_true (tepl_file_saver_get_file (saver) == file); g_assert_true (tepl_file_saver_get_location (saver) == location); g_assert_cmpint (tepl_file_saver_get_flags (saver), ==, TEPL_FILE_SAVER_FLAGS_NONE); gtk_text_buffer_set_text (text_buffer, "oh", -1); g_assert_true (gtk_text_buffer_get_modified (text_buffer)); save_sync (saver); g_assert_true (!gtk_text_buffer_get_modified (text_buffer)); g_object_unref (file); g_object_unref (saver); file = tepl_file_new (); g_assert_true (tepl_file_get_location (file) == NULL); saver = tepl_file_saver_new_with_target (buffer, file, location); g_assert_true (tepl_file_get_location (file) == NULL); save_sync (saver); g_assert_true (tepl_file_get_location (file) == location); g_object_unref (buffer); g_object_unref (file); g_object_unref (location); g_object_unref (saver); } int main (int argc, char **argv) { gtk_test_init (&argc, &argv); g_test_add_func ("/file_saver/basic", test_basic); g_test_add_func ("/file_saver/backup", test_backup); g_test_add_func ("/file_saver/properties", test_properties); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-file.c000066400000000000000000000273621526404732400275470ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include #include "tepl-test-utils.h" static gchar * unsaved_document_title_cb (gint num) { return g_strdup_printf ("Unsaved Document %d", num); } static void check_short_name (TeplFile *file, const gchar *expected_short_name) { gchar *received_short_name; received_short_name = tepl_file_get_short_name (file); g_assert_cmpstr (received_short_name, ==, expected_short_name); g_free (received_short_name); } static void check_full_name (TeplFile *file, const gchar *expected_full_name) { gchar *received_full_name; received_full_name = tepl_file_get_full_name (file); g_assert_cmpstr (received_full_name, ==, expected_full_name); g_free (received_full_name); } static void check_short_name_is_unsaved_document_number (TeplFile *file, gint num) { gchar *expected_short_name; expected_short_name = unsaved_document_title_cb (num); check_short_name (file, expected_short_name); g_free (expected_short_name); } static void check_full_name_is_unsaved_document_number (TeplFile *file, gint num) { gchar *expected_full_name; expected_full_name = unsaved_document_title_cb (num); check_full_name (file, expected_full_name); g_free (expected_full_name); } static void test_unsaved_document_titles (void) { GflsUnsavedDocumentTitles *titles; TeplFile *file1; TeplFile *file2; TeplFile *file3; GFile *location; titles = gfls_unsaved_document_titles_get_default (); gfls_unsaved_document_titles_set_title_callback (titles, unsaved_document_title_cb); file1 = tepl_file_new (); check_short_name_is_unsaved_document_number (file1, 1); file2 = tepl_file_new (); check_short_name_is_unsaved_document_number (file2, 2); /* Release a number by destroying a file. */ g_object_unref (file1); check_short_name_is_unsaved_document_number (file2, 2); // still the same. file1 = tepl_file_new (); check_short_name_is_unsaved_document_number (file1, 1); /* Release a number by setting a location. */ location = g_file_new_for_path ("location"); tepl_file_set_location (file1, location); check_short_name_is_unsaved_document_number (file2, 2); // still the same. file3 = tepl_file_new (); check_short_name_is_unsaved_document_number (file3, 1); /* Reset location to NULL. */ tepl_file_set_location (file1, NULL); check_short_name_is_unsaved_document_number (file1, 3); g_object_unref (file1); g_object_unref (file2); g_object_unref (file3); g_object_unref (location); } static void test_short_name (void) { TeplFile *file; GFile *location; TeplWaitSignalData *data; GError *error = NULL; location = g_file_new_build_filename (g_get_tmp_dir (), "tepl-test-file", NULL); /* Get the fallback short-name, for a file that doesn't exist. */ g_file_delete (location, NULL, &error); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { g_clear_error (&error); } g_assert_no_error (error); file = tepl_file_new (); data = _tepl_test_utils_wait_signal_setup (G_OBJECT (file), "notify::short-name"); tepl_file_set_location (file, location); _tepl_test_utils_wait_signal (data); check_short_name (file, "tepl-test-file"); g_object_unref (file); /* Get the display-name for a local file (so the file must exist). */ _tepl_test_utils_set_file_content (location, "file content"); file = tepl_file_new (); data = _tepl_test_utils_wait_signal_setup (G_OBJECT (file), "notify::short-name"); tepl_file_set_location (file, location); _tepl_test_utils_wait_signal (data); check_short_name (file, "tepl-test-file"); g_object_unref (file); g_object_unref (location); /* Test the special case for a remote location that has no parent GFile. */ location = g_file_new_for_uri ("https://swilmet.be"); file = tepl_file_new (); data = _tepl_test_utils_wait_signal_setup (G_OBJECT (file), "notify::short-name"); tepl_file_set_location (file, location); _tepl_test_utils_wait_signal (data); check_short_name (file, "https://swilmet.be"); g_object_unref (file); g_object_unref (location); // It's not really important if the trailing slash is still present or // not in the short-name, but test it anyway. The important thing is to // have the https://swilmet.be prefix, with an optional trailing slash. location = g_file_new_for_uri ("https://swilmet.be/"); file = tepl_file_new (); data = _tepl_test_utils_wait_signal_setup (G_OBJECT (file), "notify::short-name"); tepl_file_set_location (file, location); _tepl_test_utils_wait_signal (data); check_short_name (file, "https://swilmet.be/"); g_object_unref (file); g_object_unref (location); } static void test_full_name (void) { GflsUnsavedDocumentTitles *titles; TeplFile *file; GFile *location; titles = gfls_unsaved_document_titles_get_default (); gfls_unsaved_document_titles_set_title_callback (titles, unsaved_document_title_cb); file = tepl_file_new (); check_full_name_is_unsaved_document_number (file, 1); location = g_file_new_for_path ("/one/path"); tepl_file_set_location (file, location); check_full_name (file, "/one/path"); g_object_unref (location); } #if 0 static void sleep_for_one_second (void) { g_usleep (G_USEC_PER_SEC); } static void load_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplFileLoader *loader = TEPL_FILE_LOADER (source_object); GError *error = NULL; tepl_file_loader_load_finish (loader, result, &error); g_assert_no_error (error); gtk_main_quit (); } static void load (TeplBuffer *buffer) { TeplFile *file; TeplFileLoader *loader; file = tepl_buffer_get_file (buffer); loader = tepl_file_loader_new (buffer, file); tepl_file_loader_load_async (loader, G_PRIORITY_DEFAULT, NULL, /* cancellable */ NULL, NULL, NULL, /* progress cb */ load_cb, NULL); gtk_main (); g_object_unref (loader); } static void save_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TeplFileSaver *saver = TEPL_FILE_SAVER (source_object); gboolean expect_externally_modified_error = GPOINTER_TO_INT (user_data); GError *error = NULL; tepl_file_saver_save_finish (saver, result, &error); if (expect_externally_modified_error) { g_assert_true (g_error_matches (error, TEPL_FILE_SAVER_ERROR, TEPL_FILE_SAVER_ERROR_EXTERNALLY_MODIFIED)); g_clear_error (&error); } else { g_assert_no_error (error); } gtk_main_quit (); } static void save (TeplBuffer *buffer, gboolean expect_externally_modified_error) { TeplFile *file; TeplFileSaver *saver; file = tepl_buffer_get_file (buffer); saver = tepl_file_saver_new (buffer, file); tepl_file_saver_save_async (saver, G_PRIORITY_DEFAULT, NULL, /* cancellable */ NULL, NULL, NULL, /* progress cb */ save_cb, GINT_TO_POINTER (expect_externally_modified_error)); gtk_main (); if (expect_externally_modified_error) { expect_externally_modified_error = FALSE; tepl_file_saver_set_flags (saver, TEPL_FILE_SAVER_FLAGS_IGNORE_MODIFICATION_TIME); tepl_file_saver_save_async (saver, G_PRIORITY_DEFAULT, NULL, /* cancellable */ NULL, NULL, NULL, /* progress cb */ save_cb, GINT_TO_POINTER (expect_externally_modified_error)); gtk_main (); } g_object_unref (saver); } static void save_as (TeplBuffer *buffer, GFile *new_location) { TeplFile *file; TeplFileSaver *saver; gboolean expect_externally_modified_error = FALSE; file = tepl_buffer_get_file (buffer); saver = tepl_file_saver_new_with_target (buffer, file, new_location); tepl_file_saver_save_async (saver, G_PRIORITY_DEFAULT, NULL, /* cancellable */ NULL, NULL, NULL, /* progress cb */ save_cb, GINT_TO_POINTER (expect_externally_modified_error)); gtk_main (); g_object_unref (saver); } static void test_externally_modified (void) { TeplBuffer *buffer; TeplFile *file; gchar *path; gchar *new_path; GFile *location; GFile *new_location; GError *error = NULL; buffer = tepl_buffer_new (); file = tepl_buffer_get_file (buffer); /* With NULL location */ g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Set location, but not yet loaded or saved */ path = g_build_filename (g_get_tmp_dir (), "tepl-test-file", NULL); g_file_set_contents (path, "a", -1, &error); g_assert_no_error (error); location = g_file_new_for_path (path); tepl_file_set_location (file, location); g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Load */ load (buffer); g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Save */ save (buffer, FALSE); g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Modify externally and then save. * Sleep one second to force the timestamp/etag to change. */ sleep_for_one_second (); g_file_set_contents (path, "b", -1, &error); g_assert_no_error (error); tepl_file_check_file_on_disk (file); g_assert_true (tepl_file_is_externally_modified (file)); save (buffer, TRUE); g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Modify externally and then load */ sleep_for_one_second (); g_file_set_contents (path, "c", -1, &error); g_assert_no_error (error); tepl_file_check_file_on_disk (file); g_assert_true (tepl_file_is_externally_modified (file)); load (buffer); g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Modify externally and then save as */ sleep_for_one_second (); g_file_set_contents (path, "d", -1, &error); g_assert_no_error (error); tepl_file_check_file_on_disk (file); g_assert_true (tepl_file_is_externally_modified (file)); new_path = g_build_filename (g_get_tmp_dir (), "tepl-test-file-2", NULL); g_file_set_contents (new_path, "e", -1, &error); g_assert_no_error (error); new_location = g_file_new_for_path (new_path); save_as (buffer, new_location); g_assert_true (g_file_equal (new_location, tepl_file_get_location (file))); g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Modify externally and then save as to same location */ sleep_for_one_second (); g_file_set_contents (new_path, "f", -1, &error); g_assert_no_error (error); tepl_file_check_file_on_disk (file); g_assert_true (tepl_file_is_externally_modified (file)); g_assert_true (g_file_equal (new_location, tepl_file_get_location (file))); save_as (buffer, new_location); g_assert_true (!tepl_file_is_externally_modified (file)); tepl_file_check_file_on_disk (file); g_assert_true (!tepl_file_is_externally_modified (file)); /* Cleanup */ g_file_delete (location, NULL, &error); g_assert_no_error (error); g_file_delete (new_location, NULL, &error); g_assert_no_error (error); g_free (path); g_free (new_path); g_object_unref (location); g_object_unref (new_location); g_object_unref (buffer); } #endif int main (int argc, char **argv) { gtk_test_init (&argc, &argv); g_test_add_func ("/file/unsaved_document_titles", test_unsaved_document_titles); g_test_add_func ("/file/short_name", test_short_name); g_test_add_func ("/file/full_name", test_full_name); #if 0 g_test_add_func ("/file/externally_modified", test_externally_modified); #endif return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-fold-region.c000066400000000000000000000256071526404732400310350ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016 - David Rabel * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static GtkTextBuffer * test_create_and_fill_buffer (guint lines) { GtkTextBuffer *buffer; guint i; buffer = gtk_text_buffer_new (NULL); for (i = 0; i < lines; i++) { gtk_text_buffer_insert_at_cursor (buffer, "Another Line...\n", -1); } return buffer; } static TeplFoldRegion * test_create_fold_region (GtkTextBuffer *buffer, guint start_line, guint end_line) { GtkTextIter start_iter; GtkTextIter end_iter; gtk_text_buffer_get_iter_at_line (buffer, &start_iter, start_line); gtk_text_buffer_get_iter_at_line (buffer, &end_iter, end_line); return tepl_fold_region_new (buffer, &start_iter, &end_iter); } static guint test_next_visible_line (GtkTextBuffer *buffer, guint line) { GtkTextIter iter; gtk_text_buffer_get_iter_at_line (buffer, &iter, line); gtk_text_iter_forward_visible_line (&iter); return gtk_text_iter_get_line (&iter); } static void test_set_bounds_with_line_number (TeplFoldRegion *fold_region, guint start_line, guint end_line) { GtkTextIter start_iter; GtkTextIter end_iter; GtkTextBuffer *buffer; buffer = tepl_fold_region_get_buffer (fold_region); gtk_text_buffer_get_iter_at_line (buffer, &start_iter, start_line); gtk_text_buffer_get_iter_at_line (buffer, &end_iter, end_line); tepl_fold_region_set_bounds (fold_region, &start_iter, &end_iter); } static void test_fold (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); tepl_fold_region_set_folded (fold_region, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 4); g_object_unref (fold_region); g_object_unref (buffer); } static void test_unfold (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); tepl_fold_region_set_folded (fold_region, TRUE); tepl_fold_region_set_folded (fold_region, FALSE); g_assert_true (test_next_visible_line (buffer, 1) == 2); g_object_unref (fold_region); g_object_unref (buffer); } static void test_toggle (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; gboolean folded; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); folded = tepl_fold_region_get_folded (fold_region); g_assert_true (folded == FALSE); folded = !folded; tepl_fold_region_set_folded (fold_region, folded); folded = tepl_fold_region_get_folded (fold_region); g_assert_true (folded == TRUE); folded = !folded; tepl_fold_region_set_folded (fold_region, folded); folded = tepl_fold_region_get_folded (fold_region); g_assert_true (folded == FALSE); g_object_unref (fold_region); g_object_unref (buffer); } static void test_set_bounds (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); test_set_bounds_with_line_number (fold_region, 2, 4); tepl_fold_region_set_folded (fold_region, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 2); g_assert_true (test_next_visible_line (buffer, 2) == 5); g_object_unref (fold_region); g_object_unref (buffer); } static void test_set_bounds_while_folded (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); tepl_fold_region_set_folded (fold_region, TRUE); test_set_bounds_with_line_number (fold_region, 2, 4); g_assert_true (test_next_visible_line (buffer, 1) == 2); g_assert_true (test_next_visible_line (buffer, 2) == 5); g_object_unref (fold_region); g_object_unref (buffer); } static void test_get_bounds (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; GtkTextIter start_iter; GtkTextIter end_iter; guint start_line; guint end_line; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); tepl_fold_region_set_folded (fold_region, TRUE); tepl_fold_region_get_bounds (fold_region, &start_iter, &end_iter); start_line = gtk_text_iter_get_line (&start_iter); end_line = gtk_text_iter_get_line (&end_iter); g_assert_true (test_next_visible_line (buffer, start_line) == end_line + 1); g_object_unref (fold_region); g_object_unref (buffer); } static void test_unref_while_folded (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); tepl_fold_region_set_folded (fold_region, TRUE); g_clear_object (&fold_region); g_assert_true (test_next_visible_line (buffer, 1) == 2); g_object_unref (buffer); } static void test_clear_buffer (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; GtkTextIter start_iter; GtkTextIter end_iter; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); gtk_text_buffer_set_text (buffer, "", -1); tepl_fold_region_get_bounds (fold_region, &start_iter, &end_iter); g_assert_true (gtk_text_iter_get_line (&start_iter) == 0); g_assert_true (gtk_text_iter_get_line (&end_iter) == 0); g_object_unref (fold_region); g_object_unref (buffer); } static void test_bounds_at_middle_of_line (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; GtkTextIter start_iter; GtkTextIter end_iter; buffer = test_create_and_fill_buffer (6); gtk_text_buffer_get_iter_at_line (buffer, &start_iter, 1); gtk_text_buffer_get_iter_at_line (buffer, &end_iter, 3); gtk_text_iter_forward_chars (&start_iter, 3); gtk_text_iter_forward_chars (&end_iter, 3); fold_region = tepl_fold_region_new (buffer, &start_iter, &end_iter); tepl_fold_region_set_folded (fold_region, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 4); g_object_unref (fold_region); g_object_unref (buffer); } static void test_bounds_at_end_of_line (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; GtkTextIter start_iter; GtkTextIter end_iter; buffer = test_create_and_fill_buffer (6); gtk_text_buffer_get_iter_at_line (buffer, &start_iter, 1); gtk_text_buffer_get_iter_at_line (buffer, &end_iter, 3); gtk_text_iter_forward_line (&start_iter); gtk_text_iter_backward_char (&start_iter); gtk_text_iter_forward_line (&end_iter); gtk_text_iter_backward_char (&end_iter); fold_region = tepl_fold_region_new (buffer, &start_iter, &end_iter); tepl_fold_region_set_folded (fold_region, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 4); g_object_unref (fold_region); g_object_unref (buffer); } static void test_double_fold (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); tepl_fold_region_set_folded (fold_region, TRUE); tepl_fold_region_set_folded (fold_region, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 4); tepl_fold_region_set_folded (fold_region, FALSE); g_assert_true (test_next_visible_line (buffer, 1) == 2); g_object_unref (fold_region); g_object_unref (buffer); } static void test_double_unfold (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; buffer = test_create_and_fill_buffer (6); fold_region = test_create_fold_region (buffer, 1, 3); tepl_fold_region_set_folded (fold_region, TRUE); tepl_fold_region_set_folded (fold_region, FALSE); tepl_fold_region_set_folded (fold_region, FALSE); g_assert_true (test_next_visible_line (buffer, 1) == 2); tepl_fold_region_set_folded (fold_region, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 4); g_object_unref (fold_region); g_object_unref (buffer); } static void test_overlapping_regions (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region1; TeplFoldRegion *fold_region2; buffer = test_create_and_fill_buffer (6); fold_region1 = test_create_fold_region (buffer, 1, 3); fold_region2 = test_create_fold_region (buffer, 2, 4); tepl_fold_region_set_folded (fold_region1, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 4); tepl_fold_region_set_folded (fold_region2, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 5); tepl_fold_region_set_folded (fold_region1, FALSE); tepl_fold_region_set_folded (fold_region2, FALSE); tepl_fold_region_set_folded (fold_region2, TRUE); g_assert_true (test_next_visible_line (buffer, 2) == 5); tepl_fold_region_set_folded (fold_region1, TRUE); g_assert_true (test_next_visible_line (buffer, 1) == 5); tepl_fold_region_set_folded (fold_region1, FALSE); g_assert_true (test_next_visible_line (buffer, 2) == 5); tepl_fold_region_set_folded (fold_region2, FALSE); g_assert_true (test_next_visible_line (buffer, 2) == 3); tepl_fold_region_set_folded (fold_region1, TRUE); tepl_fold_region_set_folded (fold_region2, TRUE); tepl_fold_region_set_folded (fold_region2, FALSE); g_assert_true (test_next_visible_line (buffer, 1) == 4); tepl_fold_region_set_folded (fold_region1, FALSE); g_assert_true (test_next_visible_line (buffer, 2) == 3); g_object_unref (fold_region1); g_object_unref (fold_region2); g_object_unref (buffer); } static void test_call_other_methods_before_set_bounds (void) { GtkTextBuffer *buffer; TeplFoldRegion *fold_region; GtkTextIter start_iter; GtkTextIter end_iter; buffer = test_create_and_fill_buffer (6); fold_region = g_object_new (TEPL_TYPE_FOLD_REGION, "buffer", buffer, NULL); tepl_fold_region_set_folded (fold_region, TRUE); tepl_fold_region_set_folded (fold_region, FALSE); tepl_fold_region_get_folded (fold_region); tepl_fold_region_get_buffer (fold_region); tepl_fold_region_get_bounds (fold_region, &start_iter, &end_iter); g_object_unref (fold_region); g_object_unref (buffer); } gint main (gint argc, gchar **argv) { gtk_test_init (&argc, &argv, NULL); g_test_add_func ("/fold-region/fold", test_fold); g_test_add_func ("/fold-region/unfold", test_unfold); g_test_add_func ("/fold-region/toggle", test_toggle); g_test_add_func ("/fold-region/set_bounds", test_set_bounds); g_test_add_func ("/fold-region/set_bounds_while_folded", test_set_bounds_while_folded); g_test_add_func ("/fold-region/get_bounds", test_get_bounds); g_test_add_func ("/fold-region/unref_while_folded", test_unref_while_folded); g_test_add_func ("/fold-region/clear_buffer", test_clear_buffer); g_test_add_func ("/fold-region/bounds_at_middle_of_line", test_bounds_at_middle_of_line); g_test_add_func ("/fold-region/bounds_at_end_of_line", test_bounds_at_end_of_line); g_test_add_func ("/fold-region/double_fold", test_double_fold); g_test_add_func ("/fold-region/double_unfold", test_double_unfold); g_test_add_func ("/fold-region/overlapping_regions", test_overlapping_regions); g_test_add_func ("/fold-region/call_other_methods_before_set_bounds", test_call_other_methods_before_set_bounds); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-icu.c000066400000000000000000000051311526404732400273760ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include "tepl/tepl-icu.h" static void check_str_from_and_to_utf8_raw (const gchar *utf8_str, gboolean expect_success) { UChar *uchars; gchar *utf8_str_after_round_trip; UErrorCode error_code = U_ZERO_ERROR; uchars = _tepl_icu_strFromUTF8 (NULL, utf8_str, -1, &error_code); if (expect_success) { g_assert_true (U_SUCCESS (error_code)); } else { g_assert_true (U_FAILURE (error_code)); g_free (uchars); return; } error_code = U_ZERO_ERROR; utf8_str_after_round_trip = _tepl_icu_strToUTF8 (NULL, uchars, -1, &error_code); g_assert_cmpstr (utf8_str, ==, utf8_str_after_round_trip); g_free (uchars); g_free (utf8_str_after_round_trip); } static void check_str_from_and_to_utf8_simple (const gchar *utf8_str, gboolean expect_success) { UChar *uchars; gchar *utf8_str_after_round_trip; uchars = _tepl_icu_strFromUTF8Simple (utf8_str); if (expect_success) { g_assert_true (uchars != NULL); } else { g_assert_true (uchars == NULL); return; } utf8_str_after_round_trip = _tepl_icu_strToUTF8Simple (uchars); g_assert_cmpstr (utf8_str, ==, utf8_str_after_round_trip); g_free (uchars); g_free (utf8_str_after_round_trip); } static void check_str_from_and_to_utf8 (const gchar *utf8_str, gboolean expect_success) { check_str_from_and_to_utf8_raw (utf8_str, expect_success); check_str_from_and_to_utf8_simple (utf8_str, expect_success); } static void test_str_from_and_to_utf8 (void) { check_str_from_and_to_utf8 (NULL, FALSE); check_str_from_and_to_utf8 ("", TRUE); check_str_from_and_to_utf8 ("ASCII", TRUE); check_str_from_and_to_utf8 ("À ski", TRUE); /* Not valid UTF-8. */ check_str_from_and_to_utf8 ("\xFF", FALSE); } static void test_strdup (void) { UChar *uchars; UChar *uchars_copy; gchar *utf8_str; uchars = _tepl_icu_strFromUTF8Simple ("Évo"); uchars_copy = _tepl_icu_strdup (uchars); utf8_str = _tepl_icu_strToUTF8Simple (uchars_copy); g_assert_cmpstr (utf8_str, ==, "Évo"); g_free (uchars); g_free (uchars_copy); g_free (utf8_str); } static void test_trans_open (void) { UTransliterator *transliterator; transliterator = _tepl_icu_trans_open_xml_escape (); g_assert_true (transliterator != NULL); utrans_close (transliterator); } int main (int argc, char **argv) { g_test_init (&argc, &argv, NULL); g_test_add_func ("/icu/str_from_and_to_utf8", test_str_from_and_to_utf8); g_test_add_func ("/icu/strdup", test_strdup); g_test_add_func ("/icu/trans_open", test_trans_open); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-info-bar.c000066400000000000000000000010371526404732400303140ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static void test_info_bar_creation (void) { TeplInfoBar *info_bar; /* Just to see if it doesn't trigger any warnings. */ info_bar = tepl_info_bar_new (); g_object_ref_sink (info_bar); g_object_unref (info_bar); } gint main (gint argc, gchar **argv) { gtk_test_init (&argc, &argv, NULL); g_test_add_func ("/info-bar/creation", test_info_bar_creation); return g_test_run (); } test-metadata-manager-data/000077500000000000000000000000001526404732400324725ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-testsexpected-to-fail-00-empty.xml000066400000000000000000000000001526404732400377050ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-dataexpected-to-fail-01.xml000066400000000000000000000000771526404732400365700ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data expected-to-fail-02.xml000066400000000000000000000001321526404732400365610ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data expected-to-fail-03.xml000066400000000000000000000002501526404732400365630ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data expected-to-fail-04.xml000066400000000000000000000002201526404732400365610ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data expected-to-fail-05.xml000066400000000000000000000002721526404732400365710ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data expected-to-fail-06.xml000066400000000000000000000002401526404732400365650ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data expected-to-fail-07-garbage.xml000066400000000000000000000000131526404732400401520ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data&#!+]$/%!! expected-to-succeed-01-trim-after.xml000066400000000000000000000002361526404732400413350ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data expected-to-succeed-01-trim-before.xml000066400000000000000000000006441526404732400415010ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata-manager-data test-metadata-manager.c000066400000000000000000000212351526404732400317320ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include "tepl-test-utils.h" static void check_get (TeplMetadata *metadata, const gchar *key, const gchar *expected_value) { gchar *received_value; received_value = tepl_metadata_get (metadata, key); g_assert_cmpstr (expected_value, ==, received_value); g_free (received_value); } static GFile * get_store_file_for_test_data_filename (const gchar *filename) { return g_file_new_build_filename (UNIT_TESTS_SOURCE_DIR, "test-metadata-manager-data", filename, NULL); } static GFile * save_metadata_manager (void) { GFile *tmp_file; TeplMetadataManager *manager; GError *error = NULL; tmp_file = g_file_new_build_filename (g_get_tmp_dir (), "tepl-test-metadata-manager.xml", NULL); g_file_delete (tmp_file, NULL, &error); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { g_clear_error (&error); } g_assert_no_error (error); manager = tepl_metadata_manager_get_singleton (); tepl_metadata_manager_save_to_disk (manager, tmp_file, TRUE, &error); g_assert_no_error (error); return tmp_file; } static void test_merge_into_and_copy_from_part1 (void) { TeplMetadataManager *manager; TeplMetadata *metadata; GFile *location; manager = tepl_metadata_manager_get_singleton (); metadata = tepl_metadata_new (); location = g_file_new_for_path ("location"); tepl_metadata_manager_copy_from (manager, location, metadata); tepl_metadata_manager_merge_into (manager, location, metadata); tepl_metadata_set (metadata, "key", "valueA"); tepl_metadata_manager_copy_from (manager, location, metadata); check_get (metadata, "key", "valueA"); // the value has been kept even though it is not in @manager. tepl_metadata_manager_merge_into (manager, location, metadata); check_get (metadata, "key", "valueA"); g_object_unref (metadata); metadata = tepl_metadata_new (); tepl_metadata_manager_copy_from (manager, location, metadata); check_get (metadata, "key", "valueA"); tepl_metadata_set (metadata, "key", "valueB"); check_get (metadata, "key", "valueB"); tepl_metadata_manager_copy_from (manager, location, metadata); check_get (metadata, "key", "valueA"); // the value has been overwritten. g_object_unref (metadata); g_object_unref (location); _tepl_metadata_manager_unref_singleton (); } static void test_merge_into_and_copy_from_part2 (void) { TeplMetadataManager *manager; TeplMetadata *metadata; GFile *location; manager = tepl_metadata_manager_get_singleton (); location = g_file_new_for_path ("location"); metadata = tepl_metadata_new (); tepl_metadata_set (metadata, "keyA", "valueA"); tepl_metadata_manager_merge_into (manager, location, metadata); g_object_unref (metadata); metadata = tepl_metadata_new (); tepl_metadata_set (metadata, "keyB", "valueB"); tepl_metadata_manager_merge_into (manager, location, metadata); // keyA is kept in @manager. g_object_unref (metadata); metadata = tepl_metadata_new (); tepl_metadata_manager_copy_from (manager, location, metadata); check_get (metadata, "keyA", "valueA"); check_get (metadata, "keyB", "valueB"); g_object_unref (metadata); g_object_unref (location); _tepl_metadata_manager_unref_singleton (); } /* Store metadata into the TeplMetadataManager for several locations. */ static void test_merge_into_and_copy_from_part3 (void) { TeplMetadataManager *manager; TeplMetadata *metadataA; TeplMetadata *metadataB; GFile *locationA; GFile *locationB; manager = tepl_metadata_manager_get_singleton (); locationA = g_file_new_for_path ("locationA"); locationB = g_file_new_for_path ("locationB"); metadataA = tepl_metadata_new (); tepl_metadata_set (metadataA, "key", "valueA"); tepl_metadata_manager_merge_into (manager, locationA, metadataA); g_object_unref (metadataA); metadataB = tepl_metadata_new (); tepl_metadata_set (metadataB, "key", "valueB"); tepl_metadata_manager_merge_into (manager, locationB, metadataB); g_object_unref (metadataB); metadataA = tepl_metadata_new (); tepl_metadata_manager_copy_from (manager, locationA, metadataA); check_get (metadataA, "key", "valueA"); g_object_unref (metadataA); metadataB = tepl_metadata_new (); tepl_metadata_manager_copy_from (manager, locationB, metadataB); check_get (metadataB, "key", "valueB"); g_object_unref (metadataB); g_object_unref (locationA); g_object_unref (locationB); _tepl_metadata_manager_unref_singleton (); } static void check_load_from_disk (const gchar *filename, gboolean expect_to_succeed) { TeplMetadataManager *manager; GFile *file; GError *error = NULL; manager = tepl_metadata_manager_get_singleton (); file = get_store_file_for_test_data_filename (filename); tepl_metadata_manager_load_from_disk (manager, file, &error); if (expect_to_succeed) { g_assert_no_error (error); } else { g_assert_true (error != NULL); g_error_free (error); } g_object_unref (file); _tepl_metadata_manager_unref_singleton (); } static void test_load_from_disk_expected_to_fail (void) { check_load_from_disk ("expected-to-fail-00-empty.xml", FALSE); check_load_from_disk ("expected-to-fail-01.xml", FALSE); check_load_from_disk ("expected-to-fail-02.xml", FALSE); check_load_from_disk ("expected-to-fail-03.xml", FALSE); check_load_from_disk ("expected-to-fail-04.xml", FALSE); check_load_from_disk ("expected-to-fail-05.xml", FALSE); check_load_from_disk ("expected-to-fail-06.xml", FALSE); check_load_from_disk ("expected-to-fail-07-garbage.xml", FALSE); } static void test_load_from_disk_expected_to_succeed (void) { check_load_from_disk ("expected-to-succeed-01-trim-before.xml", TRUE); check_load_from_disk ("expected-to-succeed-01-trim-after.xml", TRUE); } static void check_value_round_trip (const gchar *value) { TeplMetadataManager *manager; GFile *location; GFile *store_file; TeplMetadata *metadata; GError *error = NULL; manager = tepl_metadata_manager_get_singleton (); location = g_file_new_for_path ("location"); /* Set value */ metadata = tepl_metadata_new (); tepl_metadata_set (metadata, "key", value); tepl_metadata_manager_merge_into (manager, location, metadata); g_object_unref (metadata); /* Save to disk */ store_file = save_metadata_manager (); _tepl_metadata_manager_unref_singleton (); /* Load from disk */ manager = tepl_metadata_manager_get_singleton (); tepl_metadata_manager_load_from_disk (manager, store_file, &error); g_assert_no_error (error); /* Read value after round-trip */ metadata = tepl_metadata_new (); tepl_metadata_manager_copy_from (manager, location, metadata); check_get (metadata, "key", value); g_object_unref (metadata); g_object_unref (location); g_object_unref (store_file); _tepl_metadata_manager_unref_singleton (); } static void test_value_round_trip (void) { check_value_round_trip (""); check_value_round_trip ("a"); check_value_round_trip ("1"); check_value_round_trip ("Évo-UTF-8"); check_value_round_trip (","); check_value_round_trip (";"); check_value_round_trip (" "); check_value_round_trip ("\t"); check_value_round_trip (" \t\t \t\noh"); check_value_round_trip ("123ASCIIabc.,;/_-:"); } static void test_trim (void) { TeplMetadataManager *manager; GFile *file_before; GFile *file_after; GFile *expected_file_after; GError *error = NULL; manager = tepl_metadata_manager_get_singleton (); file_before = get_store_file_for_test_data_filename ("expected-to-succeed-01-trim-before.xml"); tepl_metadata_manager_load_from_disk (manager, file_before, &error); g_assert_no_error (error); tepl_metadata_manager_trim (manager, 1); file_after = save_metadata_manager (); expected_file_after = get_store_file_for_test_data_filename ("expected-to-succeed-01-trim-after.xml"); _tepl_test_utils_check_equal_files_content (file_after, expected_file_after); g_object_unref (file_before); g_object_unref (file_after); g_object_unref (expected_file_after); _tepl_metadata_manager_unref_singleton (); } int main (int argc, char **argv) { g_test_init (&argc, &argv, NULL); g_test_add_func ("/metadata_manager/merge_into_and_copy_from_part1", test_merge_into_and_copy_from_part1); g_test_add_func ("/metadata_manager/merge_into_and_copy_from_part2", test_merge_into_and_copy_from_part2); g_test_add_func ("/metadata_manager/merge_into_and_copy_from_part3", test_merge_into_and_copy_from_part3); g_test_add_func ("/metadata_manager/load_from_disk_expected_to_fail", test_load_from_disk_expected_to_fail); g_test_add_func ("/metadata_manager/load_from_disk_expected_to_succeed", test_load_from_disk_expected_to_succeed); g_test_add_func ("/metadata_manager/value_round_trip", test_value_round_trip); g_test_add_func ("/metadata_manager/trim", test_trim); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-metadata.c000066400000000000000000000045561526404732400304100ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static void test_key_is_valid (void) { g_assert_true (_tepl_metadata_key_is_valid ("gedit-spell-checking-language")); g_assert_true (_tepl_metadata_key_is_valid ("gCSVedit_column_delimiter")); g_assert_true (_tepl_metadata_key_is_valid ("Fourty_Two-1337")); g_assert_true (_tepl_metadata_key_is_valid ("1337-beginning-with-digit")); g_assert_true (_tepl_metadata_key_is_valid ("a")); g_assert_true (_tepl_metadata_key_is_valid ("9")); g_assert_true (!_tepl_metadata_key_is_valid (NULL)); g_assert_true (!_tepl_metadata_key_is_valid ("")); g_assert_true (!_tepl_metadata_key_is_valid ("metadata::gedit-spell-checking-language")); g_assert_true (!_tepl_metadata_key_is_valid ("foo:bar")); g_assert_true (!_tepl_metadata_key_is_valid ("foo::bar")); g_assert_true (!_tepl_metadata_key_is_valid ("Évolution-UTF-8")); g_assert_true (!_tepl_metadata_key_is_valid ("a space")); g_assert_true (!_tepl_metadata_key_is_valid ("\t")); g_assert_true (!g_utf8_validate ("\xFF", -1, NULL)); g_assert_true (!_tepl_metadata_key_is_valid ("\xFF")); } static void check_get (TeplMetadata *metadata, const gchar *key, const gchar *expected_value) { gchar *received_value; received_value = tepl_metadata_get (metadata, key); g_assert_cmpstr (expected_value, ==, received_value); g_free (received_value); } static void test_get_set (void) { TeplMetadata *metadata; metadata = tepl_metadata_new (); check_get (metadata, "keyA", NULL); tepl_metadata_set (metadata, "keyA", "valueA1"); check_get (metadata, "keyA", "valueA1"); tepl_metadata_set (metadata, "keyB", "valueB"); check_get (metadata, "keyA", "valueA1"); check_get (metadata, "keyB", "valueB"); check_get (metadata, "keyC", NULL); tepl_metadata_set (metadata, "keyA", "valueA2"); check_get (metadata, "keyA", "valueA2"); check_get (metadata, "keyB", "valueB"); tepl_metadata_set (metadata, "keyB", NULL); check_get (metadata, "keyA", "valueA2"); check_get (metadata, "keyB", NULL); check_get (metadata, "keyC", NULL); g_object_unref (metadata); } int main (int argc, char **argv) { g_test_init (&argc, &argv, NULL); g_test_add_func ("/metadata/key_is_valid", test_key_is_valid); g_test_add_func ("/metadata/get_set", test_get_set); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-notebook.c000066400000000000000000000204331526404732400304400ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static void check_list_equal (GList *expected_list, GList *received_list) { GList *l1; GList *l2; g_assert_cmpint (g_list_length (expected_list), ==, g_list_length (received_list)); for (l1 = expected_list, l2 = received_list; l1 != NULL && l2 != NULL; l1 = l1->next, l2 = l2->next) { gpointer expected_data = l1->data; gpointer received_data = l2->data; g_assert_true (expected_data == received_data); } g_assert_true (l1 == NULL); g_assert_true (l2 == NULL); } static void test_tab_group_basic (void) { GtkNotebook *notebook; TeplTabGroup *tab_group; GtkWidget *other_widget; TeplTab *tab1; TeplTab *tab2; GList *expected_list; GList *received_list; notebook = GTK_NOTEBOOK (tepl_notebook_new ()); tab_group = TEPL_TAB_GROUP (notebook); g_object_ref_sink (notebook); gtk_widget_show (GTK_WIDGET (notebook)); /* Empty */ g_assert_true (tepl_tab_group_get_tabs (tab_group) == NULL); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == NULL); /* One child, but not a TeplTab */ other_widget = gtk_grid_new (); gtk_widget_show (other_widget); gtk_notebook_append_page (notebook, other_widget, NULL); g_assert_cmpint (gtk_notebook_get_n_pages (notebook), ==, 1); g_assert_true (tepl_tab_group_get_tabs (tab_group) == NULL); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == NULL); /* Append one TeplTab */ tab1 = tepl_tab_new (); gtk_widget_show (GTK_WIDGET (tab1)); tepl_tab_group_append_tab (tab_group, tab1, TRUE); expected_list = g_list_append (NULL, tab1); g_assert_cmpint (gtk_notebook_get_n_pages (notebook), ==, 2); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == tab1); received_list = tepl_tab_group_get_tabs (tab_group); check_list_equal (expected_list, received_list); g_list_free (received_list); received_list = NULL; gtk_notebook_set_current_page (notebook, 0); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == NULL); received_list = tepl_tab_group_get_tabs (tab_group); check_list_equal (expected_list, received_list); g_list_free (received_list); received_list = NULL; /* Append a second TeplTab */ tab2 = tepl_tab_new (); gtk_widget_show (GTK_WIDGET (tab2)); tepl_tab_group_append_tab (tab_group, tab2, FALSE); expected_list = g_list_append (expected_list, tab2); gtk_notebook_set_current_page (notebook, gtk_notebook_page_num (notebook, other_widget)); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == NULL); tepl_tab_group_set_active_tab (tab_group, tab1); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == tab1); tepl_tab_group_set_active_tab (tab_group, tab2); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == tab2); received_list = tepl_tab_group_get_tabs (tab_group); check_list_equal (expected_list, received_list); g_list_free (received_list); received_list = NULL; /* Move tab2 before tab1 */ gtk_notebook_reorder_child (notebook, GTK_WIDGET (tab2), 0); expected_list = g_list_reverse (expected_list); received_list = tepl_tab_group_get_tabs (tab_group); check_list_equal (expected_list, received_list); g_list_free (received_list); received_list = NULL; g_list_free (expected_list); g_object_unref (notebook); } typedef struct { gint active_tab_notify_delta_count; /* Must be always equal to active_tab_notify_delta_count. */ gint active_view_notify_delta_count; gint active_buffer_notify_delta_count; } NotifyDeltaCounters; static void check_notify_delta_counters (NotifyDeltaCounters *delta_counters, gint expected_tab_delta, gint expected_buffer_delta) { g_assert_cmpint (delta_counters->active_tab_notify_delta_count, ==, expected_tab_delta); g_assert_cmpint (delta_counters->active_view_notify_delta_count, ==, expected_tab_delta); g_assert_cmpint (delta_counters->active_buffer_notify_delta_count, ==, expected_buffer_delta); delta_counters->active_tab_notify_delta_count = 0; delta_counters->active_view_notify_delta_count = 0; delta_counters->active_buffer_notify_delta_count = 0; } static void notify_cb (TeplTabGroup *tab_group, GParamSpec *pspec, gint *counter) { (*counter)++; } static void change_buffer (TeplTab *tab) { TeplView *view; TeplBuffer *new_buffer; view = tepl_tab_get_view (tab); new_buffer = tepl_buffer_new (); gtk_text_view_set_buffer (GTK_TEXT_VIEW (view), GTK_TEXT_BUFFER (new_buffer)); g_object_unref (new_buffer); } static void test_tab_group_notify_signals (void) { GtkNotebook *notebook; TeplTabGroup *tab_group; TeplTab *tab1; TeplTab *tab2; TeplTab *tab3; NotifyDeltaCounters delta_counters = { 0, 0, 0 }; notebook = GTK_NOTEBOOK (tepl_notebook_new ()); tab_group = TEPL_TAB_GROUP (notebook); g_object_ref_sink (notebook); gtk_widget_show (GTK_WIDGET (notebook)); g_signal_connect (tab_group, "notify::active-tab", G_CALLBACK (notify_cb), &(delta_counters.active_tab_notify_delta_count)); g_signal_connect (tab_group, "notify::active-view", G_CALLBACK (notify_cb), &(delta_counters.active_view_notify_delta_count)); g_signal_connect (tab_group, "notify::active-buffer", G_CALLBACK (notify_cb), &(delta_counters.active_buffer_notify_delta_count)); /* Create first tab. */ tab1 = tepl_tab_new (); gtk_widget_show (GTK_WIDGET (tab1)); tepl_tab_group_append_tab (tab_group, tab1, FALSE); check_notify_delta_counters (&delta_counters, 1, 1); /* For the first tab, GtkNotebook has already set it as the active tab. */ tepl_tab_group_set_active_tab (tab_group, tab1); check_notify_delta_counters (&delta_counters, 0, 0); /* Change buffer */ change_buffer (tab1); check_notify_delta_counters (&delta_counters, 0, 1); /* Remove tab -> active-tab is NULL. */ gtk_widget_destroy (GTK_WIDGET (tab1)); check_notify_delta_counters (&delta_counters, 1, 1); g_assert_true (tepl_tab_group_get_tabs (tab_group) == NULL); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == NULL); /* Re-create first tab. */ tab1 = tepl_tab_new (); gtk_widget_show (GTK_WIDGET (tab1)); // With jump_to = TRUE this time. tepl_tab_group_append_tab (tab_group, tab1, TRUE); check_notify_delta_counters (&delta_counters, 1, 1); /* Append a second tab. */ tab2 = tepl_tab_new (); gtk_widget_show (GTK_WIDGET (tab2)); tepl_tab_group_append_tab (tab_group, tab2, FALSE); check_notify_delta_counters (&delta_counters, 0, 0); tepl_tab_group_set_active_tab (tab_group, tab2); check_notify_delta_counters (&delta_counters, 1, 1); /* Change buffer of tab1. */ change_buffer (tab1); check_notify_delta_counters (&delta_counters, 0, 0); /* Change buffer of tab2. */ change_buffer (tab2); check_notify_delta_counters (&delta_counters, 0, 1); /* Switch tabs */ tepl_tab_group_set_active_tab (tab_group, tab1); check_notify_delta_counters (&delta_counters, 1, 1); tepl_tab_group_set_active_tab (tab_group, tab2); check_notify_delta_counters (&delta_counters, 1, 1); /* Reorder non-active tab */ gtk_notebook_reorder_child (notebook, GTK_WIDGET (tab1), 1); check_notify_delta_counters (&delta_counters, 0, 0); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == tab2); /* Reorder active tab. * The order is reset to tab1 -> tab2. */ gtk_notebook_reorder_child (notebook, GTK_WIDGET (tab2), 1); check_notify_delta_counters (&delta_counters, 0, 0); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == tab2); /* Append a third tab. */ tab3 = tepl_tab_new (); gtk_widget_show (GTK_WIDGET (tab3)); tepl_tab_group_append_tab (tab_group, tab3, FALSE); check_notify_delta_counters (&delta_counters, 0, 0); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == tab2); /* Remove a non-active tab. */ gtk_widget_destroy (GTK_WIDGET (tab1)); check_notify_delta_counters (&delta_counters, 0, 0); /* Remove active tab. */ gtk_widget_destroy (GTK_WIDGET (tab2)); check_notify_delta_counters (&delta_counters, 1, 1); g_assert_true (tepl_tab_group_get_active_tab (tab_group) == tab3); g_object_unref (notebook); } int main (int argc, char **argv) { gtk_test_init (&argc, &argv, NULL); g_test_add_func ("/notebook/tab-group-basic", test_tab_group_basic); g_test_add_func ("/notebook/tab-group-notify-signals", test_tab_group_notify_signals); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-panel-item.c000066400000000000000000000061241526404732400306540ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static void test_basics (void) { GtkWidget *label; TeplPanelItem *item; GtkWidget *prop_widget = NULL; gchar *prop_name = NULL; gchar *prop_title = NULL; gchar *prop_icon_name = NULL; gint prop_position = 0; label = gtk_label_new (NULL); item = tepl_panel_item_new (label, "name", "Title", NULL, 5); /* Getter functions */ g_assert_true (tepl_panel_item_get_widget (item) == label); g_assert_cmpstr (tepl_panel_item_get_name (item), ==, "name"); g_assert_cmpstr (tepl_panel_item_get_title (item), ==, "Title"); g_assert_null (tepl_panel_item_get_icon_name (item)); g_assert_cmpint (tepl_panel_item_get_position (item), ==, 5); /* Get properties */ g_object_get (item, "widget", &prop_widget, "name", &prop_name, "title", &prop_title, "icon-name", &prop_icon_name, "position", &prop_position, NULL); g_assert_true (prop_widget == label); g_assert_cmpstr (prop_name, ==, "name"); g_assert_cmpstr (prop_title, ==, "Title"); g_assert_null (prop_icon_name); g_assert_cmpint (prop_position, ==, 5); g_object_unref (prop_widget); g_free (prop_name); g_free (prop_title); /* Destroy */ gtk_widget_destroy (label); g_assert_null (tepl_panel_item_get_widget (item)); g_object_unref (item); } static void test_compare (void) { GtkWidget *label1; GtkWidget *label2; TeplPanelItem *item1; TeplPanelItem *item2; label1 = gtk_label_new (NULL); label2 = gtk_label_new (NULL); g_object_ref_sink (label1); g_object_ref_sink (label2); /* All posititons at 0 */ item1 = tepl_panel_item_new (label1, "name1", "A", NULL, 0); item2 = tepl_panel_item_new (label2, "name2", "B", NULL, 0); g_assert_cmpint (tepl_panel_item_compare_by_title (item1, item2), <, 0); g_assert_cmpint (tepl_panel_item_compare (item1, item2), <, 0); g_assert_cmpint (tepl_panel_item_compare_by_title (item2, item1), >, 0); g_assert_cmpint (tepl_panel_item_compare (item2, item1), >, 0); g_assert_cmpint (tepl_panel_item_compare_by_title (item1, item1), ==, 0); g_assert_cmpint (tepl_panel_item_compare (item1, item1), ==, 0); g_object_unref (item1); g_object_unref (item2); /* With different positions */ item1 = tepl_panel_item_new (label1, "name1", "A", NULL, 1); item2 = tepl_panel_item_new (label2, "name2", "B", NULL, 0); g_assert_cmpint (tepl_panel_item_compare_by_title (item1, item2), <, 0); g_assert_cmpint (tepl_panel_item_compare (item1, item2), >, 0); g_assert_cmpint (tepl_panel_item_compare_by_title (item2, item1), >, 0); g_assert_cmpint (tepl_panel_item_compare (item2, item1), <, 0); g_assert_cmpint (tepl_panel_item_compare_by_title (item1, item1), ==, 0); g_assert_cmpint (tepl_panel_item_compare (item1, item1), ==, 0); g_object_unref (item1); g_object_unref (item2); g_object_unref (label1); g_object_unref (label2); } int main (int argc, char **argv) { gtk_test_init (&argc, &argv); g_test_add_func ("/PanelItem/basics", test_basics); g_test_add_func ("/PanelItem/compare", test_compare); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-panel-simple.c000066400000000000000000000114351526404732400312100ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2023-2024 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static void test_basics (void) { TeplPanelSimple *panel; GtkWidget *label1; GtkWidget *label2; TeplPanelItem *item1; TeplPanelItem *item2; GList *items; panel = tepl_panel_simple_new (); /* Initially empty */ g_assert_null (tepl_panel_simple_get_items (panel)); g_assert_null (tepl_panel_simple_get_active_item (panel)); g_assert_false (tepl_panel_simple_has_several_items (panel)); /* Add an item */ label1 = gtk_label_new (NULL); item1 = tepl_panel_item_new (label1, "name1", "Title 1", NULL, 0); tepl_panel_add (TEPL_PANEL (panel), item1); items = tepl_panel_simple_get_items (panel); g_assert_cmpint (g_list_length (items), ==, 1); g_assert_true (items->data == item1); g_list_free_full (items, g_object_unref); g_assert_null (tepl_panel_simple_get_active_item (panel)); g_assert_false (tepl_panel_simple_has_several_items (panel)); tepl_panel_set_active (TEPL_PANEL (panel), item1); g_assert_true (tepl_panel_simple_get_active_item (panel) == item1); /* Add one more item */ label2 = gtk_label_new (NULL); item2 = tepl_panel_item_new (label2, "name2", "Title 2", "icon-name", 0); tepl_panel_add (TEPL_PANEL (panel), item2); items = tepl_panel_simple_get_items (panel); g_assert_cmpint (g_list_length (items), ==, 2); g_list_free_full (items, g_object_unref); g_assert_true (tepl_panel_simple_get_active_item (panel) == item1); tepl_panel_set_active (TEPL_PANEL (panel), item2); g_assert_true (tepl_panel_simple_get_active_item (panel) == item2); tepl_panel_set_active (TEPL_PANEL (panel), item1); g_assert_true (tepl_panel_simple_get_active_item (panel) == item1); g_assert_true (tepl_panel_simple_has_several_items (panel)); /* Remove an item */ tepl_panel_remove (TEPL_PANEL (panel), item1); g_object_unref (item1); items = tepl_panel_simple_get_items (panel); g_assert_cmpint (g_list_length (items), ==, 1); g_assert_true (items->data == item2); g_list_free_full (items, g_object_unref); g_assert_null (tepl_panel_simple_get_active_item (panel)); g_assert_false (tepl_panel_simple_has_several_items (panel)); /* Remove last item, empty again */ tepl_panel_remove (TEPL_PANEL (panel), item2); g_object_unref (item2); g_assert_null (tepl_panel_simple_get_items (panel)); g_assert_null (tepl_panel_simple_get_active_item (panel)); g_assert_false (tepl_panel_simple_has_several_items (panel)); g_object_unref (panel); } static void test_active_item_name (void) { GtkWidget *label1; GtkWidget *label2; TeplPanelItem *item1; TeplPanelItem *item2; TeplPanelSimple *panel; label1 = gtk_label_new (NULL); label2 = gtk_label_new (NULL); item1 = tepl_panel_item_new (label1, "name1", "Title 1", NULL, 0); item2 = tepl_panel_item_new (label2, "name2", "Title 2", NULL, 0); /* Empty */ panel = tepl_panel_simple_new (); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); tepl_panel_simple_set_active_item_name (panel, NULL); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); tepl_panel_simple_set_active_item_name (panel, "not-found"); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); /* Add an item */ tepl_panel_add (TEPL_PANEL (panel), item1); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); tepl_panel_simple_set_active_item_name (panel, "name1"); g_assert_cmpstr (tepl_panel_simple_get_active_item_name (panel), ==, "name1"); tepl_panel_simple_set_active_item_name (panel, "not-found"); g_assert_cmpstr (tepl_panel_simple_get_active_item_name (panel), ==, "name1"); tepl_panel_simple_set_active_item_name (panel, NULL); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); /* With two items */ tepl_panel_add (TEPL_PANEL (panel), item2); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); tepl_panel_simple_set_active_item_name (panel, "name2"); g_assert_cmpstr (tepl_panel_simple_get_active_item_name (panel), ==, "name2"); tepl_panel_simple_set_active_item_name (panel, "name1"); g_assert_cmpstr (tepl_panel_simple_get_active_item_name (panel), ==, "name1"); /* Remove active-item */ tepl_panel_remove (TEPL_PANEL (panel), item1); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); tepl_panel_simple_set_active_item_name (panel, "name2"); g_assert_cmpstr (tepl_panel_simple_get_active_item_name (panel), ==, "name2"); tepl_panel_remove (TEPL_PANEL (panel), item2); g_assert_null (tepl_panel_simple_get_active_item_name (panel)); g_object_unref (item1); g_object_unref (item2); g_object_unref (panel); } int main (int argc, char **argv) { gtk_test_init (&argc, &argv); g_test_add_func ("/PanelSimple/basics", test_basics); g_test_add_func ("/PanelSimple/active_item_name", test_active_item_name); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-utils.c000066400000000000000000000217511526404732400277640ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2016-2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static void test_str_middle_truncate (void) { gchar *truncated_str; truncated_str = tepl_utils_str_middle_truncate ("1234567890", 5); g_assert_cmpstr (truncated_str, ==, "12…90"); g_free (truncated_str); } static void test_str_end_truncate (void) { gchar *truncated_str; truncated_str = tepl_utils_str_end_truncate ("1234567890", 5); g_assert_cmpstr (truncated_str, ==, "1234…"); g_free (truncated_str); } static void test_str_replace (void) { gchar *result; result = tepl_utils_str_replace ("$filename", "$filename", "blah"); g_assert_cmpstr (result, ==, "blah"); g_free (result); result = tepl_utils_str_replace ("$shortname.pdf", "$shortname", "blah"); g_assert_cmpstr (result, ==, "blah.pdf"); g_free (result); result = tepl_utils_str_replace ("abcdabcd", "ab", "r"); g_assert_cmpstr (result, ==, "rcdrcd"); g_free (result); result = tepl_utils_str_replace ("abcd", "ef", "r"); g_assert_cmpstr (result, ==, "abcd"); g_free (result); /* Only one pass. */ result = tepl_utils_str_replace ("aaaa", "aa", "a"); g_assert_cmpstr (result, ==, "aa"); /* Not: "a" */ g_free (result); } static void check_markup_escape_text (const gchar *src, const gchar *expected_dest) { gchar *received_dest; received_dest = tepl_utils_markup_escape_text (src); g_assert_cmpstr (received_dest, ==, expected_dest); g_free (received_dest); } static void test_markup_escape_text (void) { check_markup_escape_text ("", ""); check_markup_escape_text ("123ASCIIabc.,;/_-:", "123ASCIIabc.,;/_-:"); check_markup_escape_text ("é", "é"); check_markup_escape_text ("\t", " "); check_markup_escape_text ("ẞ", "ẞ"); // multi-byte UTF-8 char. { gchar *dest; /* If this changes in the future, maybe g_markup_escape_text() * has been modified to fully support round-trip integrity, in * which case tepl_utils_markup_escape_text() is no longer * useful. */ dest = g_markup_escape_text ("\t", -1); g_assert_cmpstr (dest, ==, "\t"); g_free (dest); } } static void test_get_file_extension (void) { gchar *extension; extension = tepl_utils_get_file_extension ("file.pdf"); g_assert_cmpstr (extension, ==, ".pdf"); g_free (extension); extension = tepl_utils_get_file_extension ("file.PDF"); g_assert_cmpstr (extension, ==, ".pdf"); g_free (extension); extension = tepl_utils_get_file_extension ("file.tar.gz"); g_assert_cmpstr (extension, ==, ".gz"); g_free (extension); extension = tepl_utils_get_file_extension ("path" G_DIR_SEPARATOR_S "file.pdf"); g_assert_cmpstr (extension, ==, ".pdf"); g_free (extension); extension = tepl_utils_get_file_extension ("file"); g_assert_cmpstr (extension, ==, ""); g_free (extension); /* UTF-8 */ extension = tepl_utils_get_file_extension ("filé.éÉÈè"); g_assert_cmpstr (extension, ==, ".ééèè"); g_free (extension); } static void test_get_file_shortname (void) { gchar *shortname; shortname = tepl_utils_get_file_shortname ("file.txt"); g_assert_cmpstr (shortname, ==, "file"); g_free (shortname); shortname = tepl_utils_get_file_shortname ("file.tar.gz"); g_assert_cmpstr (shortname, ==, "file.tar"); g_free (shortname); shortname = tepl_utils_get_file_shortname ("file"); g_assert_cmpstr (shortname, ==, "file"); g_free (shortname); shortname = tepl_utils_get_file_shortname ("dir.ext" G_DIR_SEPARATOR_S "blah"); g_assert_cmpstr (shortname, ==, "dir.ext" G_DIR_SEPARATOR_S "blah"); g_free (shortname); /* UTF-8 */ shortname = tepl_utils_get_file_shortname ("filé.éÉÈè"); g_assert_cmpstr (shortname, ==, "filé"); g_free (shortname); } static void check_replace_home_dir_with_tilde (const gchar *home_dir, const gchar *filename_before, const gchar *expected_filename_after) { gchar *received_filename_after; received_filename_after = _tepl_utils_replace_home_dir_with_tilde_with_param (filename_before, home_dir); g_assert_cmpstr (received_filename_after, ==, expected_filename_after); g_free (received_filename_after); } static void test_replace_home_dir_with_tilde (void) { check_replace_home_dir_with_tilde ("/home/foo", "/home/foo", "~"); check_replace_home_dir_with_tilde ("/home/foo", "/home/foo/", "~"); check_replace_home_dir_with_tilde ("/home/foo/", "/home/foo", "~"); check_replace_home_dir_with_tilde ("/home/foo/", "/home/foo/", "~"); check_replace_home_dir_with_tilde ("/home/foo", "/home/foo/bar", "~/bar"); check_replace_home_dir_with_tilde ("/home/foo/", "/home/foo/bar", "~/bar"); check_replace_home_dir_with_tilde ("/home/foo", "/home/foo/bar/", "~/bar/"); check_replace_home_dir_with_tilde ("/home/foo/", "/home/foo/bar/", "~/bar/"); check_replace_home_dir_with_tilde ("/home/foo", "/blah", "/blah"); check_replace_home_dir_with_tilde ("/home/foo/", "/blah", "/blah"); check_replace_home_dir_with_tilde (NULL, "/home/foo", "/home/foo"); check_replace_home_dir_with_tilde (NULL, "/home/foo/", "/home/foo/"); check_replace_home_dir_with_tilde ("", "/home/foo", "/home/foo"); check_replace_home_dir_with_tilde ("", "/home/foo/", "/home/foo/"); } static void test_decode_uri (void) { gchar *host; gboolean ret; /* Basic test, for what is used in Tepl (the host). */ ret = tepl_utils_decode_uri ("smb://example.net/home/file.c", NULL, NULL, &host, NULL, NULL); g_assert_true (ret); g_assert_cmpstr (host, ==, "example.net"); g_free (host); ret = tepl_utils_decode_uri ("smb://154.23.201.4/home/file.c", NULL, NULL, &host, NULL, NULL); g_assert_true (ret); g_assert_cmpstr (host, ==, "154.23.201.4"); g_free (host); } static void test_get_fallback_basename_for_display (void) { GFile *location; gchar *basename; location = g_file_new_for_path ("/home/seb/blom"); basename = _tepl_utils_get_fallback_basename_for_display (location); g_assert_cmpstr (basename, ==, "blom"); g_object_unref (location); g_free (basename); location = g_file_new_for_uri ("ssh://swilmet@example.net/home/swilmet/bloum"); basename = _tepl_utils_get_fallback_basename_for_display (location); g_assert_cmpstr (basename, ==, "bloum"); g_object_unref (location); g_free (basename); location = g_file_new_for_uri ("https://example.net"); basename = _tepl_utils_get_fallback_basename_for_display (location); g_assert_cmpstr (basename, ==, "https://example.net"); g_object_unref (location); g_free (basename); location = g_file_new_for_uri ("https://bugzilla.gnome.org/page.cgi?id=browse.html&product=gtksourceview"); basename = _tepl_utils_get_fallback_basename_for_display (location); g_assert_cmpstr (basename, ==, "page.cgi?id=browse.html&product=gtksourceview"); g_object_unref (location); g_free (basename); } static void test_set_widget_case1 (void) { GtkWidget *location = NULL; tepl_utils_set_widget (&location, NULL); g_assert_null (location); } static void test_set_widget_case2 (void) { GtkWidget *label; GtkWidget *location = NULL; label = gtk_label_new (NULL); tepl_utils_set_widget (&location, label); g_assert_true (location == label); gtk_widget_destroy (label); label = NULL; g_assert_null (location); } static void test_set_widget_case3 (void) { GtkWidget *label; GtkWidget *location = NULL; label = gtk_label_new (NULL); g_object_ref_sink (label); tepl_utils_set_widget (&location, label); g_assert_true (location == label); tepl_utils_set_widget (&location, NULL); g_assert_null (location); g_object_unref (label); } static void test_set_widget_case4 (void) { GtkWidget *label1; GtkWidget *label2; GtkWidget *location = NULL; label1 = gtk_label_new (NULL); label2 = gtk_label_new (NULL); g_object_ref_sink (label1); g_object_ref_sink (label2); tepl_utils_set_widget (&location, label1); g_assert_true (location == label1); tepl_utils_set_widget (&location, label2); g_assert_true (location == label2); gtk_widget_destroy (label1); g_assert_true (location == label2); gtk_widget_destroy (label2); g_assert_null (location); g_object_unref (label1); g_object_unref (label2); } int main (int argc, char **argv) { gtk_test_init (&argc, &argv); g_test_add_func ("/utils/str-middle-truncate", test_str_middle_truncate); g_test_add_func ("/utils/str-end-truncate", test_str_end_truncate); g_test_add_func ("/utils/str-replace", test_str_replace); g_test_add_func ("/utils/markup-escape-text", test_markup_escape_text); g_test_add_func ("/utils/get-file-extension", test_get_file_extension); g_test_add_func ("/utils/get-file-shortname", test_get_file_shortname); g_test_add_func ("/utils/replace-home-dir-with-tilde", test_replace_home_dir_with_tilde); g_test_add_func ("/utils/decode-uri", test_decode_uri); g_test_add_func ("/utils/get-fallback-basename-for-display", test_get_fallback_basename_for_display); g_test_add_func ("/utils/set_widget_case1", test_set_widget_case1); g_test_add_func ("/utils/set_widget_case2", test_set_widget_case2); g_test_add_func ("/utils/set_widget_case3", test_set_widget_case3); g_test_add_func ("/utils/set_widget_case4", test_set_widget_case4); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tests/unit-tests/test-view.c000066400000000000000000000112431526404732400275710ustar00rootroot00000000000000/* SPDX-FileCopyrightText: 2022 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include static void delete_current_line (TeplView *view) { g_signal_emit_by_name (view, "delete-from-cursor", GTK_DELETE_PARAGRAPHS, 1); } static void select_range (GtkTextBuffer *buffer, gint selection_start_offset, gint selection_end_offset) { GtkTextIter selection_start_iter; GtkTextIter selection_end_iter; gtk_text_buffer_get_iter_at_offset (buffer, &selection_start_iter, selection_start_offset); gtk_text_buffer_get_iter_at_offset (buffer, &selection_end_iter, selection_end_offset); gtk_text_buffer_select_range (buffer, &selection_start_iter, &selection_end_iter); } static void check_buffer_content (GtkTextBuffer *buffer, const gchar *expected_content) { GtkTextIter start; GtkTextIter end; gchar *content; gtk_text_buffer_get_bounds (buffer, &start, &end); content = gtk_text_buffer_get_slice (buffer, &start, &end, TRUE); g_assert_cmpstr (content, ==, expected_content); g_free (content); } static void check_delete_current_line (TeplView *view, const gchar *content_before, gint selection_start_offset_before, gint selection_end_offset_before, const gchar *content_after, gint cursor_offset_after) { GtkTextBuffer *buffer; GtkTextIter cursor_pos; /* Prepa */ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_set_text (buffer, content_before, -1); select_range (buffer, selection_start_offset_before, selection_end_offset_before); /* Operation */ delete_current_line (view); /* Checks */ check_buffer_content (buffer, content_after); g_assert_false (gtk_text_buffer_get_has_selection (buffer)); gtk_text_buffer_get_iter_at_mark (buffer, &cursor_pos, gtk_text_buffer_get_insert (buffer)); g_assert_cmpint (cursor_offset_after, ==, gtk_text_iter_get_offset (&cursor_pos)); } static void test_delete_current_line (void) { TeplView *view; view = TEPL_VIEW (tepl_view_new ()); g_object_ref_sink (view); /* Empty buffer */ check_delete_current_line (view, "", 0, 0, "", 0); /* Single line without trailing \n */ // Without selection check_delete_current_line (view, "ab", 0, 0, "", 0); check_delete_current_line (view, "ab", 1, 1, "", 0); check_delete_current_line (view, "ab", 2, 2, "", 0); // With selection check_delete_current_line (view, "ab", 0, 1, "", 0); check_delete_current_line (view, "ab", 0, 2, "", 0); check_delete_current_line (view, "ab", 1, 2, "", 0); /* Single line with trailing \n (so two lines with the second line * empty). */ // Without selection check_delete_current_line (view, "ab\n", 0, 0, "", 0); check_delete_current_line (view, "ab\n", 1, 1, "", 0); check_delete_current_line (view, "ab\n", 2, 2, "", 0); check_delete_current_line (view, "ab\n", 3, 3, "ab", 0); // With selection check_delete_current_line (view, "ab\n", 0, 1, "", 0); check_delete_current_line (view, "ab\n", 0, 2, "", 0); check_delete_current_line (view, "ab\n", 1, 2, "", 0); check_delete_current_line (view, "ab\n", 0, 3, "", 0); check_delete_current_line (view, "ab\n", 1, 3, "", 0); check_delete_current_line (view, "ab\n", 2, 3, "", 0); /* Two lines, delete second line */ // Without selection check_delete_current_line (view, "ab\nc", 3, 3, "ab", 0); check_delete_current_line (view, "ab\nc", 4, 4, "ab", 0); // With selection check_delete_current_line (view, "ab\nc", 3, 4, "ab", 0); /* Two lines with selection */ check_delete_current_line (view, "a\nb", 0, 1, "b", 0); check_delete_current_line (view, "a\nb", 0, 2, "b", 0); check_delete_current_line (view, "a\nb", 0, 3, "", 0); // This one is a bit more difficult. We select only the \n, but in the // TextView the selection is visible only on the first line, after the // 'a'. So 'b' remains. check_delete_current_line (view, "a\nb", 1, 2, "b", 0); check_delete_current_line (view, "a\nb", 1, 3, "", 0); check_delete_current_line (view, "a\nb", 2, 3, "a", 0); /* Three lines */ // Without selection, delete second line check_delete_current_line (view, "ab\nc\nde", 3, 3, "ab\nde", 3); check_delete_current_line (view, "ab\nc\nde", 4, 4, "ab\nde", 3); // With selection check_delete_current_line (view, "ab\nc\nde", 3, 4, "ab\nde", 3); check_delete_current_line (view, "ab\nc\nde", 3, 5, "ab\nde", 3); check_delete_current_line (view, "ab\nc\nde", 2, 3, "c\nde", 0); check_delete_current_line (view, "ab\nc\nde", 2, 4, "de", 0); g_object_unref (view); } int main (int argc, char **argv) { gtk_test_init (&argc, &argv); g_test_add_func ("/view/delete_current_line", test_delete_current_line); return g_test_run (); } libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools/000077500000000000000000000000001526404732400233545ustar00rootroot00000000000000shared-mime-info-list-text-plain-globs/000077500000000000000000000000001526404732400325615ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools.gitignore000066400000000000000000000000301526404732400345420ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools/shared-mime-info-list-text-plain-globsmime-type-is-text-plain compile.sh000077500000000000000000000001671526404732400345540ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools/shared-mime-info-list-text-plain-globs#!/bin/sh gcc -o mime-type-is-text-plain -Wall -Wextra `pkg-config --cflags --libs gio-2.0` mime-type-is-text-plain.c globs-to-add000066400000000000000000000000101526404732400347470ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools/shared-mime-info-list-text-plain-globs*.build globs-to-ignore000066400000000000000000000003711526404732400355140ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools/shared-mime-info-list-text-plain-globs*.abw.crashed *.abw.gz authors *.C changelog cmakelists.txt copying credits *.geo.json gmon.out gnumakefile install makefile makefile.* meson.build meson_options.txt pom.xml *.qti.gz readme* *.reg sconscript sconscript.* sconstruct settings.xml *,v mime-type-is-text-plain.c000066400000000000000000000007151526404732400373320ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools/shared-mime-info-list-text-plain-globs/* SPDX-FileCopyrightText: 2020 - Sébastien Wilmet * SPDX-License-Identifier: LGPL-3.0-or-later */ #include #include int main (int argc, char **argv) { const gchar *mime_type; if (argc != 2) { g_printerr ("Usage: %s \n", argv[0]); return EXIT_FAILURE; } mime_type = argv[1]; if (g_content_type_is_a (mime_type, "text/plain")) { return EXIT_SUCCESS; } return EXIT_FAILURE; } shared-mime-info-list-text-plain-globs.sh000077500000000000000000000023671526404732400424140ustar00rootroot00000000000000libgedit-tepl-6.15.0-621fa9e8c43fafca8a0f299ac116715b3a835fbe/tools/shared-mime-info-list-text-plain-globs#!/bin/sh # SPDX-FileCopyrightText: 2020 - Sébastien Wilmet # SPDX-License-Identifier: LGPL-3.0-or-later # To have a list of all globs for text/plain files, taken from the # shared-mime-info database. The list is useful for Microsoft Windows packaging # purposes, to package a general-purpose text editor. shared_mime_info_xml_file='/usr/share/mime/packages/freedesktop.org.xml' tmp_dir='/tmp/tepl-shared-mime-info-tool/' # Have only the shared-mime-info database, not additional mime types from other # packages. rm -rf "$tmp_dir" mkdir -p "$tmp_dir/packages/" cp "$shared_mime_info_xml_file" "$tmp_dir/packages/" update-mime-database "$tmp_dir" 2>/dev/null sed '/^#/d' "${tmp_dir}/globs2" | cut -d':' -f'2,3' > "${tmp_dir}/globs2-simplified" for line in `cat "${tmp_dir}/globs2-simplified"` do mime_type=`echo "$line" | cut -d':' -f1` glob=`echo "$line" | cut -d':' -f2` if `./mime-type-is-text-plain "$mime_type"` then echo "$glob" fi done | sort | uniq > "${tmp_dir}/text-plain-globs" comm -2 -3 "${tmp_dir}/text-plain-globs" globs-to-ignore > "${tmp_dir}/text-plain-globs-filtered" cat "${tmp_dir}/text-plain-globs-filtered" globs-to-add | sort | uniq > "${tmp_dir}/text-plain-globs-final" cat "${tmp_dir}/text-plain-globs-final"