├── .editorconfig ├── .gitignore ├── .gitlab-ci.yml ├── CONTRIBUTING.md ├── LICENSES ├── CC-BY-SA-4.0.txt └── GPL-3.0-or-later.txt ├── NEWS ├── README.md ├── TODO.md ├── build-aux └── flatpak │ ├── .gitignore │ ├── README.md │ ├── org.gnome.Devhelp.Devel.json │ ├── org.gnome.Devhelp.json │ └── run-flatpak.sh ├── contrib ├── CHM_HTB2devhelp.README ├── README ├── bulkman.pl └── texi2devhelp.sh ├── data ├── assistant.css ├── assistant.js ├── devhelp.1 ├── icons │ ├── meson.build │ ├── scalable │ │ ├── org.gnome.Devhelp.Devel.svg │ │ └── org.gnome.Devhelp.svg │ ├── symbolic │ │ ├── org.gnome.Devhelp-symbolic.svg │ │ └── org.gnome.Devhelp.Devel-symbolic.svg │ └── view-left-pane-symbolic.svg ├── meson.build ├── org.gnome.Devhelp.appdata.xml.in.in ├── org.gnome.Devhelp.desktop.in.in ├── org.gnome.Devhelp.service.in ├── org.gnome.devhelp.gschema.xml └── org.gnome.libdevhelp.gschema.xml.in ├── devhelp.doap ├── devhelp ├── devhelp.h ├── dh-application-window.c ├── dh-application-window.h ├── dh-assistant-view.c ├── dh-assistant-view.h ├── dh-book-list-builder.c ├── dh-book-list-builder.h ├── dh-book-list-directory.c ├── dh-book-list-directory.h ├── dh-book-list-simple.c ├── dh-book-list-simple.h ├── dh-book-list.c ├── dh-book-list.h ├── dh-book-manager.c ├── dh-book-manager.h ├── dh-book-tree.c ├── dh-book-tree.h ├── dh-book.c ├── dh-book.h ├── dh-completion.c ├── dh-completion.h ├── dh-error.c ├── dh-error.h ├── dh-init.c ├── dh-init.h ├── dh-keyword-model.c ├── dh-keyword-model.h ├── dh-link.c ├── dh-link.h ├── dh-notebook.c ├── dh-notebook.h ├── dh-parser.c ├── dh-parser.h ├── dh-profile-builder.c ├── dh-profile-builder.h ├── dh-profile.c ├── dh-profile.h ├── dh-search-bar.c ├── dh-search-bar.h ├── dh-search-context.c ├── dh-search-context.h ├── dh-settings-builder.c ├── dh-settings-builder.h ├── dh-settings.c ├── dh-settings.h ├── dh-sidebar.c ├── dh-sidebar.h ├── dh-tab-label.c ├── dh-tab-label.h ├── dh-tab.c ├── dh-tab.h ├── dh-util-lib.c ├── dh-util-lib.h ├── dh-web-view.c ├── dh-web-view.h ├── future │ ├── README │ ├── dh-dconf-migration.c │ └── dh-dconf-migration.h ├── meson.build └── symbol.map ├── docs ├── reference │ ├── api-breaks.md │ ├── devhelp.svg │ ├── devhelp.toml.in │ └── meson.build └── similar-apps.md ├── help ├── C │ ├── book-format.page │ ├── figures │ │ └── org.gnome.Devhelp.svg │ ├── index-file-format.page │ ├── index.page │ ├── installing-api-documentation.page │ └── search.page ├── LINGUAS ├── ca │ └── ca.po ├── cs │ └── cs.po ├── da │ └── da.po ├── de │ └── de.po ├── es │ └── es.po ├── eu │ └── eu.po ├── fr │ └── fr.po ├── gl │ └── gl.po ├── hr │ └── hr.po ├── hu │ └── hu.po ├── it │ └── it.po ├── ko │ └── ko.po ├── meson.build ├── pl │ └── pl.po ├── pt_BR │ └── pt_BR.po ├── sv │ └── sv.po ├── tr │ └── tr.po ├── uk │ └── uk.po └── zh_CN │ └── zh_CN.po ├── meson.build ├── meson_options.txt ├── plugins ├── devhelp.el ├── devhelp.vim ├── gedit-plugin │ ├── devhelp.plugin.desktop.in │ ├── devhelp.py │ └── meson.build └── meson.build ├── po ├── LINGUAS ├── POTFILES.in ├── POTFILES.skip ├── ab.po ├── am.po ├── ar.po ├── as.po ├── ast.po ├── az.po ├── be.po ├── be@latin.po ├── bg.po ├── bn.po ├── bn_IN.po ├── bs.po ├── ca.po ├── ca@valencia.po ├── cs.po ├── da.po ├── de.po ├── dz.po ├── el.po ├── en@shaw.po ├── en_CA.po ├── en_GB.po ├── eo.po ├── es.po ├── et.po ├── eu.po ├── fa.po ├── fi.po ├── fr.po ├── fur.po ├── gl.po ├── gu.po ├── he.po ├── hi.po ├── hr.po ├── hu.po ├── hy.po ├── ia.po ├── id.po ├── is.po ├── it.po ├── ja.po ├── ka.po ├── kab.po ├── kk.po ├── km.po ├── kn.po ├── ko.po ├── lt.po ├── lv.po ├── mai.po ├── meson.build ├── mk.po ├── ml.po ├── ms.po ├── my.po ├── nb.po ├── ne.po ├── nl.po ├── nn.po ├── oc.po ├── or.po ├── pa.po ├── pl.po ├── ps.po ├── pt.po ├── pt_BR.po ├── ro.po ├── ru.po ├── rw.po ├── si.po ├── sk.po ├── sl.po ├── sq.po ├── sr.po ├── sr@latin.po ├── sv.po ├── ta.po ├── te.po ├── tg.po ├── th.po ├── tr.po ├── ug.po ├── uk.po ├── uz.po ├── vi.po ├── zh_CN.po ├── zh_HK.po └── zh_TW.po ├── src ├── dh-app.c ├── dh-app.h ├── dh-assistant.c ├── dh-assistant.h ├── dh-assistant.ui ├── dh-main.c ├── dh-preferences.c ├── dh-preferences.h ├── dh-preferences.ui ├── dh-settings-app.c ├── dh-settings-app.h ├── dh-util-app.c ├── dh-util-app.h ├── dh-window.c ├── dh-window.h ├── dh-window.ui ├── dh.gresource.xml ├── help-overlay.ui └── meson.build ├── subprojects └── gi-docgen.wrap └── unit-tests ├── meson.build ├── test-completion.c ├── test-link.c ├── test-search-context.c └── test-util.c /.editorconfig: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Emmanuele Bassi 2 | # 3 | # SPDX-License-Identifier: CC0-1.0 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = space 9 | indent_size = 8 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | end_of_line = lf 13 | charset = utf-8 14 | 15 | [*.json] 16 | indent_size = 2 17 | 18 | [*.md] 19 | max_line_length = 79 20 | 21 | [meson.build] 22 | indent_size = 4 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | _build/ 3 | 4 | subprojects/gi-docgen 5 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - project: 'gnome/citemplates' 3 | file: 'flatpak/flatpak_ci_initiative.yml' 4 | - component: "gitlab.gnome.org/GNOME/citemplates/release-service@master" 5 | inputs: 6 | dist-job-name: "flatpak" 7 | 8 | stages: 9 | - build 10 | - docs 11 | - deploy 12 | 13 | variables: 14 | BUNDLE: "org.gnome.Devhelp.flatpak" 15 | 16 | flatpak: 17 | stage: build 18 | extends: .flatpak 19 | variables: 20 | MANIFEST_PATH: "build-aux/flatpak/org.gnome.Devhelp.Devel.json" 21 | FLATPAK_MODULE: "devhelp" 22 | APP_ID: "org.gnome.Devhelp.Devel" 23 | RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo" 24 | 25 | nightly: 26 | extends: .publish_nightly 27 | dependencies: ['flatpak'] 28 | needs: ['flatpak'] 29 | 30 | .build-default: 31 | image: fedora:34 32 | before_script: 33 | - dnf install -y ${FEDORA_DEPS} 34 | - pip install --user meson==${MESON_VERSION} 35 | - export PATH="$PATH:$HOME/.local/bin" 36 | script: 37 | - meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build . 38 | - meson compile -C _build 39 | - meson test -C _build 40 | artifacts: 41 | when: always 42 | name: "devhelp-${CI_COMMIT_REF_NAME}" 43 | paths: 44 | - "${CI_PROJECT_DIR}/_build/meson-logs" 45 | 46 | fedora_x86_64: 47 | extends: .build-default 48 | stage: build 49 | needs: [] 50 | variables: 51 | FEDORA_DEPS: 52 | chrpath 53 | desktop-file-utils 54 | gcc 55 | gettext 56 | git 57 | glib2-devel 58 | gobject-introspection-devel 59 | gsettings-desktop-schemas-devel 60 | gtk3-devel 61 | itstool 62 | libappstream-glib 63 | ninja-build 64 | python3 65 | python3-pip 66 | python3-wheel 67 | redhat-rpm-config 68 | webkit2gtk3-devel 69 | MESON_VERSION: "0.57.2" 70 | 71 | reference: 72 | extends: .build-default 73 | stage: docs 74 | needs: [] 75 | variables: 76 | FEDORA_DEPS: 77 | chrpath 78 | desktop-file-utils 79 | gcc 80 | gettext 81 | git 82 | glib2-devel 83 | gobject-introspection-devel 84 | graphviz 85 | gsettings-desktop-schemas-devel 86 | gtk3-devel 87 | itstool 88 | libappstream-glib 89 | ninja-build 90 | python3 91 | python3-jinja2 92 | python3-markdown 93 | python3-markupsafe 94 | python3-pip 95 | python3-packaging 96 | python3-pygments 97 | python3-toml 98 | python3-typogrify 99 | python3-wheel 100 | redhat-rpm-config 101 | webkit2gtk3-devel 102 | MESON_VERSION: "0.57.2" 103 | MESON_EXTRA_FLAGS: "-Dgtk_doc=true" 104 | after_script: 105 | - mkdir _reference 106 | - mv _build/docs/reference/devhelp-3/ _reference/ 107 | artifacts: 108 | paths: 109 | - _reference 110 | 111 | pages: 112 | stage: deploy 113 | needs: ['reference'] 114 | script: 115 | - mv _reference public 116 | artifacts: 117 | paths: 118 | - public 119 | only: 120 | - main 121 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Devhelp 2 | ======= 3 | 4 | Description 5 | ----------- 6 | 7 | Devhelp is a developer tool for browsing and searching API documentation. 8 | It provides an easy way to navigate through libraries and to search by 9 | function, struct, or macro. 10 | 11 | The documentation must be installed locally, so an internet connection is 12 | not needed to use Devhelp. 13 | 14 | Devhelp works natively with the documentation generators used by the GNOME 15 | project libraries. Other development platforms can be supported as well, as 16 | long as the API documentation is available in HTML and a `*.devhelp2` index 17 | file is generated. 18 | 19 | Devhelp integrates with other applications such as Glade, Builder or 20 | Anjuta, and plugins are available for different text editors (gedit, Vim, 21 | Emacs, Geany, …). 22 | 23 | Installation of the Devhelp Flatpak 24 | ----------------------------------- 25 | 26 | - [Devhelp on Flathub](https://flathub.org/apps/details/org.gnome.Devhelp) 27 | 28 | How to contribute 29 | ----------------- 30 | 31 | See the [contribution guide](CONTRIBUTING.md). 32 | 33 | Dependencies 34 | ------------ 35 | 36 | - GLib 37 | - GTK 38 | - WebKitGTK 39 | - gsettings-desktop-schemas 40 | 41 | Integration with other developer tools 42 | -------------------------------------- 43 | 44 | Devhelp provides some command line options, such as `--search` and 45 | `--search-assistant`. A text editor plugin can for example launch the command 46 | `devhelp --search function_name` when a keyboard shortcut is pressed, with the 47 | `function_name` under the cursor. 48 | 49 | Devhelp also provides a shared library, to integrate the GTK widgets inside an 50 | IDE. It is used for example by Builder and Anjuta. 51 | 52 | For the `--search` command line option, see the class description of 53 | `DhKeywordModel`, the search string supports additional features useful for IDEs 54 | or other developer tools. 55 | 56 | Other documentation 57 | ------------------- 58 | 59 | - There is user documentation written in the Mallard format in the `help/C/` 60 | directory. You can open that documentation with the `yelp help/C/` command, 61 | or pressing F1 in the Devhelp application. 62 | 63 | - There is an API reference manual for the libdevhelp that can be built with 64 | GTK-Doc, see the `gtk_doc` build option. 65 | 66 | Default development branch 67 | -------------------------- 68 | 69 | The default development branch of Devhelp has been renamed to `main`. If you 70 | have just cloned the Devhelp repository, you don't need to change anything. 71 | If you have an older local checkout, you can use these commands to switch 72 | from the old default branch name to the new one: 73 | 74 | ``` 75 | git switch master 76 | git branch -m master main 77 | git fetch 78 | git branch --unset-upstream 79 | git branch -u origin/main 80 | git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main 81 | ``` 82 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | Possible things to do in Devhelp 2 | ================================ 3 | 4 | Normally all the codebase is in a good state, except `DhAssistant` because I 5 | don't use it (and I think it's sometimes broken). 6 | 7 | Some stuff that can be done: 8 | 9 | Improve `DhBookList` API 10 | ------------------------ 11 | 12 | Make it easier to create a custom `DhBookList`. Maybe expose publicly 13 | `DhBookListSimple` and be able to subclass it. 14 | 15 | Have man-pages for the lib C 16 | ---------------------------- 17 | 18 | See [issue 38](https://gitlab.gnome.org/GNOME/devhelp/-/issues/38). 19 | 20 | Improve `DhSettings` 21 | -------------------- 22 | 23 | See the comment in [`dh-settings.c`](./devhelp/dh-settings.c). 24 | 25 | Rename some classes 26 | ------------------- 27 | 28 | Attention to not break apps like Anjuta and Builder, so renaming classes should 29 | either be done in a backward-compatible way (deprecate the old classes, provide 30 | the new ones in parallel and implement the old classes by using the new ones), 31 | or it should be done for the next major version of the libdevhelp, with the 32 | different major versions being parallel-installable (which means moving the 33 | libdevhelp to its own git repo). 34 | 35 | - `DhSidebar` -> `DhSidePanel`. A "bar" in GNOME is more for horizontal things, 36 | like `GtkInfoBar`. 37 | - `DhKeywordModel` -> `DhSearchModel` ? 38 | -------------------------------------------------------------------------------- /build-aux/flatpak/.gitignore: -------------------------------------------------------------------------------- 1 | .flatpak-builder/ 2 | build/ 3 | -------------------------------------------------------------------------------- /build-aux/flatpak/README.md: -------------------------------------------------------------------------------- 1 | Flatpak for Devhelp 2 | =================== 3 | 4 | - `org.gnome.Devhelp.json`: the Flatpak manifest for Devhelp 5 | - `org.gnome.Devhelp.Devel.json`: The Flatpak manifest for Devhelp's 6 | development profile 7 | - `run-flatpak.sh`: a utility script for building, running, and uninstalling 8 | the Devhelp Flatpak 9 | 10 | If you want to build a Flatpak version of Devhelp: 11 | 12 | 1. make sure to have `flatpak` and `flatpak-builder` installed 13 | 2. `./run-flatpak build --app-id=org.gnome.Devhelp` to build and install 14 | 3. `./run-flatpak run --app-id=org.gnome.Devhelp` to run 15 | 4. `./run-flatpak clean --app-id=org.gnome.Devhelp` to uninstall 16 | -------------------------------------------------------------------------------- /build-aux/flatpak/org.gnome.Devhelp.Devel.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id" : "org.gnome.Devhelp.Devel", 3 | "runtime" : "org.gnome.Sdk", 4 | "runtime-version" : "master", 5 | "sdk" : "org.gnome.Sdk", 6 | "command" : "devhelp", 7 | "tags" : [ 8 | "nightly" 9 | ], 10 | "desktop-file-name-prefix" : "(Development) ", 11 | "finish-args" : [ 12 | "--share=ipc", 13 | "--socket=x11", 14 | "--socket=wayland", 15 | "--device=dri", 16 | "--filesystem=host:ro" 17 | ], 18 | "cleanup" : [ 19 | "/include", 20 | "/lib/pkgconfig", 21 | "/share/pkgconfig", 22 | "share/aclocal", 23 | "man", 24 | "share/man", 25 | "*.la", 26 | "*.a" 27 | ], 28 | "modules" : [ 29 | { 30 | "name" : "devhelp", 31 | "buildsystem" : "meson", 32 | "config-opts" : [ 33 | "-Dflatpak_build=true", 34 | "-Dprofile=devel", 35 | "-Dgtk_doc=false" 36 | ], 37 | "run-tests" : true, 38 | "sources" : [ 39 | { 40 | "type" : "git", 41 | "url" : "https://gitlab.gnome.org/GNOME/devhelp.git", 42 | "branch" : "main" 43 | } 44 | ] 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /build-aux/flatpak/org.gnome.Devhelp.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id" : "org.gnome.Devhelp", 3 | "runtime" : "org.gnome.Sdk", 4 | "runtime-version" : "master", 5 | "sdk" : "org.gnome.Sdk", 6 | "command" : "devhelp", 7 | "tags" : [ 8 | "nightly" 9 | ], 10 | "finish-args" : [ 11 | "--share=ipc", 12 | "--socket=x11", 13 | "--socket=wayland", 14 | "--device=dri", 15 | "--filesystem=host:ro" 16 | ], 17 | "cleanup" : [ 18 | "/include", 19 | "/lib/pkgconfig", 20 | "/share/pkgconfig", 21 | "share/aclocal", 22 | "man", 23 | "share/man", 24 | "*.la", 25 | "*.a" 26 | ], 27 | "modules" : [ 28 | { 29 | "name" : "devhelp", 30 | "buildsystem" : "meson", 31 | "config-opts" : [ 32 | "-Dflatpak_build=true", 33 | "-Dprofile=stable", 34 | "-Dgtk_doc=false" 35 | ], 36 | "run-tests" : true, 37 | "sources" : [ 38 | { 39 | "type" : "git", 40 | "url" : "https://gitlab.gnome.org/GNOME/devhelp.git", 41 | "branch" : "main" 42 | } 43 | ] 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /build-aux/flatpak/run-flatpak.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | read_arg() { 4 | # $1 = arg name 5 | # $2 = arg value 6 | # $3 = arg parameter 7 | local rematch='^[^=]*=(.*)$' 8 | if [[ $2 =~ $rematch ]]; then 9 | read "$1" <<< "${BASH_REMATCH[1]}" 10 | else 11 | read "$1" <<< "$3" 12 | # There is no way to shift our callers args, so 13 | # return 1 to indicate they should do it instead. 14 | return 1 15 | fi 16 | } 17 | 18 | set -e 19 | 20 | build=0 21 | run=0 22 | clean=0 23 | print_help=0 24 | 25 | while (($# > 0)); do 26 | case "${1%%=*}" in 27 | build) build=1;; 28 | run) run=1;; 29 | clean) clean=1;; 30 | help) print_help=1;; 31 | --app-id) read_arg app_id "$@" || shift;; 32 | --manifest) read_arg manifest "$@" || shift;; 33 | *) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;; 34 | esac 35 | shift 36 | done 37 | 38 | if [ $print_help == 1 ]; then 39 | echo "$0 - Build and run Flatpak" 40 | echo "" 41 | echo "Usage: $0 [options]" 42 | echo "" 43 | echo "Available commands" 44 | echo "" 45 | echo " build --manifest= - Build Flatpak " 46 | echo " run --app-id= - Run Flatpak app " 47 | echo " clean --app-id= - Uninstall Flatpak app " 48 | echo " help - This help message" 49 | echo "" 50 | exit 0 51 | fi 52 | 53 | FLATPAK_BUILDER=$( which flatpak-builder ) 54 | FLATPAK=$( which flatpak ) 55 | 56 | if [ $build == 1 ]; then 57 | if [ ! -z $app_id ]; then 58 | manifest="$app_id.json" 59 | fi 60 | 61 | if [ -z $manifest ]; then 62 | echo "Usage: $0 build --manifest=" 63 | exit 1 64 | fi 65 | 66 | if [ ! -f "$manifest" ]; then 67 | echo -e "\e[1;31mERROR\e[0m: Manifest not found" 68 | exit 1 69 | fi 70 | 71 | echo -e "\e[1;32mBUILDING\e[0m: ${manifest}" 72 | 73 | ${FLATPAK_BUILDER} --force-clean --user --install build "${manifest}" 74 | 75 | exit $? 76 | fi 77 | 78 | if [ $run == 1 ]; then 79 | if [ -z $app_id ]; then 80 | echo "Usage: $0 run --app-id=" 81 | exit 1 82 | fi 83 | 84 | ${FLATPAK} run ${app_id} 85 | 86 | exit $? 87 | fi 88 | 89 | if [ $clean == 1 ]; then 90 | if [ -z $app_id ]; then 91 | echo "Usage: $0 clean --app-id=" 92 | exit 1 93 | fi 94 | 95 | ${FLATPAK} uninstall --user $app_id 96 | 97 | exit $? 98 | fi 99 | 100 | echo "Usage: $0 " 101 | echo "See: $0 help" 102 | exit 0 103 | -------------------------------------------------------------------------------- /contrib/CHM_HTB2devhelp.README: -------------------------------------------------------------------------------- 1 | I wanted to inform DevHelp developers and users that it's now possible 2 | to convert full books in CHM and HTB into DevHelp book format, by using 3 | a generic HTML Help book framework I wrote in Python: 4 | 5 | http://htmlhelp.berlios.de/api/python/ 6 | 7 | Basically, to convert a CHM book into a DevHelp is as simple as: 8 | 9 | hhconvert /path/to/book.chm /path/to/book.tgz 10 | 11 | The code is only available in the subversion repository - there is no 12 | tarball as the code is not yet ready for prime time. 13 | 14 | That said I also want to inform that I'll stop providing more books in 15 | DevHelp format, i.e., I'll no longer update those in 16 | http://htmlhelp.berlios.de/books/devhelp.php . There is no intention in 17 | making DevHelp a full-fledge viewer. It has very limited functionality 18 | compared e.g., with PHP+MySQL web interface as in 19 | http://htmlhelp.berlios.de/web/php.php and something similar can be done 20 | much more easily with Python as in http://gnochm.sourceforge.net . I 21 | still would like to have a nice documentation browser in gnome, but I 22 | think DevHelp is no longer the way to achieve it. 23 | 24 | If anybody still wants DevHelp books they can make it themselves using 25 | the above process. 26 | 27 | In the near future I'll implement the opposite, i.e., allow convertion of 28 | DevHelp books into CHM/HTB, to use with the GTK/GNOME documentation. 29 | 30 | I hope you find this useful/interesting. 31 | 32 | José Fonseca 33 | 34 | Mail originally at: 35 | http://lists.gnome.org/archives/gnome-devtools/2004-January/msg00056.html 36 | 37 | -------------------------------------------------------------------------------- /contrib/README: -------------------------------------------------------------------------------- 1 | These scripts are not maintained by the Devhelp maintainer and suggestions and 2 | comments should be sent directly to the script author. 3 | -------------------------------------------------------------------------------- /contrib/texi2devhelp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This scripts generates a devhelp meta file using the TOC and .idx files 3 | # generated by texi2html 4 | # 5 | # written by Tobias Gruetzmacher 6 | # 7 | # Example usage: 8 | # texi2html -Verbose -split=section -idx_sum -subdir=doc/devhelp/autoconf-2.59 doc/autoconf.texi 9 | # gen-meta-devhelp.sh doc/devhelp/autoconf-2.59 autoconf Autoconf 2.59 10 | # rm doc/devhelp/autoconf-2.59/*.idx 11 | 12 | if [ "$#" -ne 4 ] 13 | then 14 | echo "Syntax: `basename $0` " 15 | exit 1 16 | fi 17 | 18 | dir=$1 19 | name=$2 20 | title=$3 21 | ver=$4 22 | 23 | exec > $dir/$name-$ver.devhelp 24 | 25 | cat < 27 | 28 | 29 | 30 | 31 | EOF 32 | 33 | sed -n '1, /^

/ d 34 | /^
$/ N 36 | s/^
\n
$// 37 | s/^
/<\/sub>/ 38 | s/<\/\?\(TT\|CODE\|FONT\)[^>]*>//ig 39 | s/\(.*\)<\/A>//p 40 | s/<\/BLOCKQUOTE>$/<\/sub>/p' $dir/${name}_toc.html | sed '$d' 41 | 42 | cat < 44 | 45 | 46 | EOF 47 | 48 | sed 's/&/\&/g; s/"/\"/g; s//\>/g 49 | s/^//' $dir/*.idx 52 | 53 | cat < 55 | 56 | 57 | EOF 58 | 59 | -------------------------------------------------------------------------------- /data/assistant.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | body * { 7 | font-size: 9pt; 8 | } 9 | 10 | a { 11 | text-decoration: none; 12 | } 13 | 14 | .title { 15 | font-size: 11pt; 16 | margin: 6pt; 17 | 18 | color: #a52a2a; 19 | } 20 | .title a { 21 | font-size: 11pt; 22 | 23 | color: #a52a2a; 24 | } 25 | .subtitle { 26 | font-size: 9pt; 27 | margin: 6pt; 28 | 29 | color: #a52a2a; 30 | } 31 | 32 | .content { 33 | margin: 6pt; 34 | line-height: 1.3em; 35 | } 36 | 37 | div.book { 38 | display: none; 39 | position: absolute; 40 | right: 6pt; 41 | top: 6pt; 42 | color: #a52a2a; 43 | } 44 | 45 | div.warning { 46 | color: #A52A2A; 47 | margin: 0 !important; 48 | } 49 | div.warning h3 { 50 | background: inherit; 51 | padding: 0; 52 | margin: 0; 53 | font-size: inherit; 54 | } 55 | 56 | div.note { 57 | margin: 0 !important; 58 | } 59 | div.note h3 { 60 | padding: 0; 61 | margin: 0; 62 | font-size: inherit; 63 | } 64 | 65 | p { 66 | margin-top: 0; 67 | margin-left: 2pt; 68 | } 69 | 70 | div.variablelist { 71 | padding: 6pt; 72 | background: #dddddd; 73 | -webkit-border-radius: 5px; 74 | } 75 | 76 | code { 77 | font-family: "Bitstream Vera Sans Mono", Monaco, Courier, monospace; 78 | font-size: 8pt; 79 | } 80 | 81 | pre.programlisting { 82 | font-family: "Bitstream Vera Sans Mono", Monaco, Courier, monospace; 83 | font-size: 8pt; 84 | padding: 6pt; 85 | background: #dddddd; 86 | -webkit-border-radius: 5px; 87 | overflow: hidden; 88 | } 89 | 90 | pre.programlisting a { 91 | font-family: "Bitstream Vera Sans Mono", Monaco, Courier, monospace; 92 | font-size: 8pt; 93 | } 94 | 95 | div.variablelist { 96 | margin-bottom: 6pt; 97 | } 98 | 99 | div.variablelist * { 100 | vertical-align: top; 101 | line-height: 1.3em; 102 | } 103 | 104 | hr { 105 | display: none; 106 | } 107 | -------------------------------------------------------------------------------- /data/assistant.js: -------------------------------------------------------------------------------- 1 | function strStrip(str) 2 | { 3 | return str.replace(/^\s*(.*?)\s*$/, "$1"); 4 | } 5 | 6 | function strCompactWhitespace(str) 7 | { 8 | var length; 9 | var i; 10 | var ret; 11 | var whitespace_count = 0; 12 | 13 | str = str.replace(/\t/, " "); 14 | 15 | ret = ""; 16 | length = str.length; 17 | i = 0; 18 | while (i < length) { 19 | if (str[i] == " ") { 20 | whitespace_count++; 21 | } else { 22 | if (whitespace_count > 0) { 23 | ret += " "; 24 | whitespace_count = 0; 25 | } 26 | ret += str[i]; 27 | } 28 | 29 | i++; 30 | } 31 | 32 | return ret; 33 | } 34 | 35 | function getIndexOfParen(str) 36 | { 37 | var length = str.length; 38 | 39 | for (var i = 0; i < length; i++) { 40 | if (str[i] == "(") 41 | return i; 42 | } 43 | 44 | return 0; 45 | } 46 | 47 | function getIndexOfLastWord(str) 48 | { 49 | for (var i = str.length; i >= 0; i--) { 50 | if (str[i] == " ") 51 | return i + 1; 52 | } 53 | 54 | return -1; 55 | } 56 | 57 | function getIndexOfLastWordIgnoreAsterisk(str) 58 | { 59 | for (var i = str.length; i >= 0; i--) { 60 | if (str[i] == " " || str[i] == "*") 61 | return i + 1; 62 | } 63 | 64 | return -1; 65 | } 66 | 67 | function buildPadding(length) 68 | { 69 | var str = ""; 70 | 71 | while (length > 0) { 72 | str += " "; 73 | length--; 74 | } 75 | 76 | return str; 77 | } 78 | 79 | function reformatSignature() 80 | { 81 | var elements = document.getElementsByClassName('programlisting'); 82 | 83 | listing = elements[0]; 84 | 85 | /* Fixup oddly formatted HTML, e.g libxml has
inside the pre 86 | * element. 87 | */ 88 | tmp = listing.innerHTML; 89 | tmp = tmp.replace("
", "\n").replace("\t", " "); 90 | listing.innerHTML = tmp; 91 | 92 | var input = listing.textContent; 93 | var lines = input.split("\n"); 94 | var line; 95 | var i; 96 | 97 | i = 0; 98 | while (line = lines[i]) { 99 | lines[i] = strCompactWhitespace(strStrip(line)); 100 | i++; 101 | } 102 | 103 | var indexOfParen = getIndexOfParen(lines[1]); 104 | var lastWordIndices = Array(lines.length); 105 | var maxIndexOfLastWord = 0; 106 | var maxDiff = 0; 107 | 108 | i = 1; 109 | while (line = lines[i]) { 110 | lastWordIndices[i] = getIndexOfLastWordIgnoreAsterisk(line); 111 | tmp = getIndexOfLastWord(line); 112 | 113 | if (i > 1) { 114 | lastWordIndices[i] += indexOfParen + 1; 115 | tmp += indexOfParen + 1; 116 | } 117 | 118 | if (tmp > maxIndexOfLastWord) 119 | maxIndexOfLastWord = tmp; 120 | 121 | if (lastWordIndices[i] - tmp > maxDiff) 122 | maxDiff = lastWordIndices[i] - tmp; 123 | 124 | i++; 125 | } 126 | 127 | maxIndexOfLastWord += maxDiff; 128 | 129 | // Now get the formatted text. 130 | var formattedLines = listing.innerHTML.split("\n"); 131 | 132 | i = 0; 133 | while (line = formattedLines[i]) { 134 | formattedLines[i] = strCompactWhitespace(strStrip(line)); 135 | i++; 136 | } 137 | 138 | var formattedLastWordIndices = Array(formattedLines.length); 139 | 140 | i = 1; 141 | while (line = formattedLines[i]) { 142 | formattedLastWordIndices[i] = getIndexOfLastWord(line); 143 | 144 | if (i > 1) 145 | formattedLastWordIndices[i] += indexOfParen + 1; 146 | 147 | i++; 148 | } 149 | 150 | padding = buildPadding(indexOfParen + 1); 151 | i = 2; 152 | while (line = formattedLines[i]) { 153 | formattedLines[i] = padding + line; 154 | i++; 155 | } 156 | 157 | i = 1; 158 | while (line = formattedLines[i]) { 159 | padding = buildPadding(maxIndexOfLastWord - lastWordIndices[i]); 160 | formattedLines[i] = line.substr(0, formattedLastWordIndices[i]) + 161 | padding + line.substr(formattedLastWordIndices[i]); 162 | 163 | i++; 164 | } 165 | 166 | var output = ""; 167 | i = 0; 168 | while (line = formattedLines[i]) { 169 | output = output + line + "\n"; 170 | i++; 171 | } 172 | 173 | listing.innerHTML = output; 174 | } 175 | 176 | function cleanupSignature() 177 | { 178 | var elements = document.getElementsByClassName('programlisting'); 179 | 180 | listing = elements[0]; 181 | 182 | var input = listing.innerHTML; 183 | var lines = input.split("\n"); 184 | 185 | var line; 186 | var i = 0; 187 | while (line = lines[i]) { 188 | lines[i] = strCompactWhitespace(strStrip(line)); 189 | i++; 190 | } 191 | 192 | var output = ""; 193 | i = 0; 194 | while (line = lines[i]) { 195 | output = output + line + "\n"; 196 | i++; 197 | } 198 | 199 | listing.innerHTML = output; 200 | } 201 | -------------------------------------------------------------------------------- /data/devhelp.1: -------------------------------------------------------------------------------- 1 | .TH "devhelp" "1" "" "" "devhelp" 2 | .SH "NAME" 3 | .LP 4 | devhelp \- An API documentation browser 5 | .SH "SYNTAX" 6 | .LP 7 | devhelp [\fIOPTIONS\fP] 8 | .SH "DESCRIPTION" 9 | .LP 10 | Devhelp is an API documentation browser for GNOME. 11 | .br 12 | .SH "OPTIONS" 13 | .LP 14 | .TP 15 | \fB\-s, \-\-search\fR=KEYWORD 16 | Search for a keyword (function, symbol...). 17 | .LP 18 | .TP 19 | \fB\-a, \-\-search-assistant\fR=KEYWORD 20 | Search and display any hit in the assistant window. 21 | .SH "EXAMPLES" 22 | .LP 23 | To run this program the standard way type: 24 | .LP 25 | devhelp 26 | .LP 27 | If you would like to search for a function, type: 28 | .LP 29 | devhelp \-s search-string 30 | .SH "AUTHORS" 31 | .LP 32 | Devhelp was written by Johan Dahlin , Mikael Hallendal 33 | , Richard Hult , Frederic Peters 34 | , Aleksander Morgado , and 35 | Ignacio Casal Quinteiro . 36 | .LP 37 | This manual page is Copyright (c) 2001 Johan Dahlin and Copyright(c) 2015 Frederic Peters . 38 | It has been written for the Debian GNU/Linux distribution and is distributed under the GNU General Public License. As such, it may be used, modified and distributed by anyone else as long as this copyright notice is preserved. 39 | -------------------------------------------------------------------------------- /data/icons/meson.build: -------------------------------------------------------------------------------- 1 | install_data([ 2 | 'scalable/@0@.svg'.format(APPLICATION_ID), 3 | ], 4 | install_dir: get_option('datadir') / 'icons/hicolor/scalable/apps', 5 | ) 6 | 7 | install_data([ 8 | 'symbolic/@0@-symbolic.svg'.format(APPLICATION_ID), 9 | ], 10 | install_dir: get_option('datadir') / 'icons/hicolor/symbolic/apps', 11 | ) 12 | -------------------------------------------------------------------------------- /data/icons/symbolic/org.gnome.Devhelp-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 21 | 23 | image/svg+xml 24 | 26 | Gnome Symbolic Icon Theme 27 | 28 | 29 | 30 | 65 | 76 | 77 | Gnome Symbolic Icon Theme 79 | 81 | 87 | 91 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /data/icons/symbolic/org.gnome.Devhelp.Devel-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 21 | 23 | image/svg+xml 24 | 26 | Gnome Symbolic Icon Theme 27 | 28 | 29 | 30 | 65 | 76 | 77 | Gnome Symbolic Icon Theme 79 | 81 | 87 | 91 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /data/icons/view-left-pane-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | subdir('icons') 2 | 3 | install_data( 4 | 'org.gnome.devhelp.gschema.xml', 5 | install_dir: get_option('datadir') / 'glib-2.0/schemas' 6 | ) 7 | 8 | libdevhelp_gschema_conf = configuration_data() 9 | libdevhelp_gschema_conf.set('LIBDEVHELP_API_VERSION', LIBDEVHELP_API_VERSION) 10 | configure_file( 11 | input: 'org.gnome.libdevhelp.gschema.xml.in', 12 | output: 'org.gnome.libdevhelp-@0@.gschema.xml'.format(LIBDEVHELP_API_VERSION), 13 | configuration: libdevhelp_gschema_conf, 14 | install: true, 15 | install_dir: get_option('datadir') / 'glib-2.0/schemas' 16 | ) 17 | 18 | appdata_conf = configuration_data() 19 | appdata_conf.set('application_id', APPLICATION_ID) 20 | appdata = APPLICATION_ID + '.appdata.xml' 21 | appdata_file = I18N.merge_file( 22 | input: configure_file( 23 | input: 'org.gnome.Devhelp.appdata.xml.in.in', 24 | output: APPLICATION_ID + '.appdata.xml.in', 25 | configuration: appdata_conf, 26 | ), 27 | output: appdata, 28 | po_dir: '../po/', 29 | install: true, 30 | install_dir: get_option('datadir') / 'metainfo' 31 | ) 32 | 33 | appstream_util = find_program('appstreamcli', required: false) 34 | if appstream_util.found() 35 | test('validate-appdata', 36 | appstream_util, 37 | args: ['validate', '--no-net', '--explain', appdata_file], 38 | workdir: meson.current_build_dir(), 39 | depends: appdata_file, 40 | ) 41 | endif 42 | 43 | desktop_conf = configuration_data() 44 | desktop_conf.set('application_id', APPLICATION_ID) 45 | desktop = APPLICATION_ID + '.desktop' 46 | desktop_file = I18N.merge_file( 47 | type: 'desktop', 48 | input: configure_file( 49 | input: 'org.gnome.Devhelp.desktop.in.in', 50 | output: APPLICATION_ID + '.desktop.in', 51 | configuration: desktop_conf, 52 | ), 53 | output: desktop, 54 | po_dir: '../po/', 55 | install: true, 56 | install_dir: get_option('datadir') / 'applications' 57 | ) 58 | 59 | desktop_file_validate = find_program('desktop-file-validate', required: false) 60 | if desktop_file_validate.found() 61 | test('validate-desktop', 62 | desktop_file_validate, 63 | args: desktop, 64 | workdir: meson.current_build_dir(), 65 | depends: desktop_file, 66 | ) 67 | endif 68 | 69 | service_file = APPLICATION_ID + '.service' 70 | service_conf = configuration_data() 71 | service_conf.set('application_id', APPLICATION_ID) 72 | service_conf.set('bindir', get_option('prefix') / get_option('bindir')) 73 | configure_file( 74 | input: 'org.gnome.Devhelp.service.in', 75 | output: service_file, 76 | configuration: service_conf, 77 | install: true, 78 | install_dir: get_option('datadir') / 'dbus-1/services' 79 | ) 80 | 81 | install_data([ 82 | 'assistant.css', 83 | 'assistant.js', 84 | ], 85 | install_dir: get_option('datadir') / 'devhelp/assistant' 86 | ) 87 | 88 | install_man('devhelp.1') 89 | -------------------------------------------------------------------------------- /data/org.gnome.Devhelp.appdata.xml.in.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | @application_id@.desktop 4 | CC0-1.0 5 | GPL-3.0-or-later 6 | Devhelp 7 | A developer tool for browsing and searching API documentation 8 | 9 |

10 | Devhelp is a developer tool for browsing and searching API documentation. 11 | It provides an easy way to navigate through libraries and to search by 12 | function, struct, or macro. 13 |

14 |

15 | The documentation must be installed locally, so an internet connection is 16 | not needed to use Devhelp. 17 |

18 |

19 | Devhelp works natively with GTK-Doc, so the GTK and GNOME libraries are 20 | well supported. But other development platforms can be supported as well, 21 | as long as the API documentation is available in HTML and a *.devhelp2 22 | index file is generated. 23 |

24 |

25 | Devhelp integrates with other applications such as Glade, Builder or 26 | Anjuta, and plugins are available for different text editors (gedit, Vim, 27 | Emacs, Geany, …). 28 |

29 |
30 | https://wiki.gnome.org/Apps/Devhelp/ 31 | https://gitlab.gnome.org/GNOME/devhelp/issues 32 | https://www.gnome.org/donate/ 33 | 34 | 35 | https://static.gnome.org/appdata/devhelp/devhelp-41-1.png 36 | Devhelp's main window 37 | 38 | 39 | https://static.gnome.org/appdata/devhelp/devhelp-41-2.png 40 | Devhelp's main window with an open book 41 | 42 | 43 | https://static.gnome.org/appdata/devhelp/devhelp-41-3.png 44 | Devhelp supports opening multiple books 45 | 46 | 47 | https://static.gnome.org/appdata/devhelp/devhelp-41-4.png 48 | Devhelp supports HTML documentation formats 49 | 50 | 51 | 52 | ebassi@gnome.org 53 | GNOME 54 | devhelp 55 | 56 | devhelp 57 | 58 | 59 | 60 | 61 |
    62 |
  • Localization updates
  • 63 |
64 |
65 |
66 | 67 | 68 |
    69 |
  • Localization updates
  • 70 |
71 |
72 |
73 | 74 | 75 |
    76 |
  • Localization updates
  • 77 |
78 |
79 |
80 | 81 | 82 |

A new cycle begins.

83 |
    84 |
  • Build against latest GNOME run time
  • 85 |
  • Localization updates
  • 86 |
87 |
88 |
89 | 90 | 91 | 92 | 93 |

Update the UI to follow the GNOME interface guidelines more closely.

94 |

Support the documentation generated by GTK 4, Pango, and other libraries.

95 |

Many localization updates.

96 |
97 |
98 | 99 | 100 | 101 |
102 |
103 | -------------------------------------------------------------------------------- /data/org.gnome.Devhelp.desktop.in.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Devhelp 3 | Comment=A developer tool for browsing and searching API documentation 4 | GenericName=API Documentation Browser 5 | # Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! 6 | Keywords=documentation;information;manual;developer;api; 7 | Exec=devhelp 8 | Terminal=false 9 | Type=Application 10 | # Translators: Do NOT translate or transliterate this text (this is an icon file name)! 11 | Icon=@application_id@ 12 | Categories=GNOME;GTK;Development; 13 | StartupNotify=true 14 | DBusActivatable=true 15 | -------------------------------------------------------------------------------- /data/org.gnome.Devhelp.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=@application_id@ 3 | Exec=@bindir@/devhelp --gapplication-service 4 | -------------------------------------------------------------------------------- /data/org.gnome.devhelp.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | false 16 | Main window maximized state 17 | Whether the main window should start maximized. 18 | 19 | 20 | 1000 21 | Width of the main window 22 | The width of the main window. 23 | 24 | 25 | 500 26 | Height of main window 27 | The height of the main window. 28 | 29 | 30 | 31 | 32 | 300 33 | Width of the index and search pane 34 | The width of the index and search pane. 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 350 43 | Width of the assistant window 44 | The width of the assistant window. 45 | 46 | 47 | 400 48 | Height of assistant window 49 | The height of the assistant window. 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /data/org.gnome.libdevhelp.gschema.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | [] 9 | Books disabled 10 | List of books disabled by the user. 11 | 12 | 13 | false 14 | Group books by language 15 | Whether books should be grouped by programming language in the user interface. 16 | 17 | 18 | 19 | 20 | true 21 | Use system fonts 22 | Use the system default fonts. 23 | 24 | 25 | 'Sans 12' 26 | Font for text 27 | Font for text with variable width. 28 | 29 | 30 | 'Monospace 12' 31 | Font for fixed width text 32 | Font for text with fixed width, such as code examples. 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /devhelp.doap: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | devhelp 9 | A developer tool for browsing and searching API documentation 10 | 11 | Devhelp is a developer tool for browsing and searching API documentation. 12 | It provides an easy way to navigate through libraries and to search by 13 | function, struct, or macro. 14 | 15 | The documentation must be installed locally, so an internet connection is 16 | not needed to use Devhelp. 17 | 18 | Devhelp works natively with GTK-Doc, so the GTK and GNOME libraries are 19 | well supported. But other development platforms can be supported as well, 20 | as long as the API documentation is available in HTML and a *.devhelp2 21 | index file is generated. 22 | 23 | Devhelp integrates with other applications such as Glade, Builder or 24 | Anjuta, and plugins are available for different text editors (gedit, Vim, 25 | Emacs, Geany, …). 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | C 35 | 36 | 37 | 38 | Emmanuele Bassi 39 | 40 | ebassi 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /devhelp/devhelp.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2012 Aleksander Morgado 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DEVHELP_H 7 | #define DEVHELP_H 8 | 9 | /* Include all the public headers. */ 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #endif /* DEVHELP_H */ 37 | -------------------------------------------------------------------------------- /devhelp/dh-application-window.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #include "dh-application-window.h" 7 | #include "dh-util-lib.h" 8 | 9 | /** 10 | * SECTION:dh-application-window 11 | * @Title: DhApplicationWindow 12 | * @Short_description: For the main application window 13 | * 14 | * Functions for the main application window. 15 | */ 16 | 17 | /** 18 | * dh_application_window_bind_sidebar_and_notebook: 19 | * @sidebar: a #DhSidebar. 20 | * @notebook: an empty #DhNotebook. 21 | * 22 | * Binds @sidebar and @notebook: 23 | * - When the #DhSidebar::link-selected signal is emitted, open the URI in the 24 | * active #DhWebView. 25 | * - On #GtkNotebook::switch-page or when the user clicks on a link, calls 26 | * dh_sidebar_select_uri() with the new active URI. 27 | * 28 | * You need to call this function when the #DhNotebook is empty, i.e. before 29 | * adding the first #DhTab. 30 | * 31 | * Note that this function doesn't take a “self” window parameter, to be more 32 | * flexible: it is possible to have several pairs of #DhSidebar/#DhNotebook per 33 | * window, to show different #DhProfile's. 34 | * 35 | * Since: 3.30 36 | */ 37 | void 38 | dh_application_window_bind_sidebar_and_notebook (DhSidebar *sidebar, 39 | DhNotebook *notebook) 40 | { 41 | g_return_if_fail (DH_IS_SIDEBAR (sidebar)); 42 | g_return_if_fail (DH_IS_NOTEBOOK (notebook)); 43 | g_return_if_fail (dh_notebook_get_active_tab (notebook) == NULL); 44 | 45 | /* Have the implementation separate from dh-application-window, because 46 | * it is planned to have a real DhApplicationWindow class in the 47 | * libdevhelp that will have similar signal handlers, it would be 48 | * confusing to have two times the same signal handlers. 49 | * 50 | * API design: 51 | * But the public function belongs to the window, since the window is 52 | * the container containing the two widgets. Another container 53 | * containing the two widgets, in the Devhelp app, is the horizontal 54 | * GtkPaned, but it would have been less flexible to create a GtkPaned 55 | * subclass with the bind() function, because it would have forced an 56 | * IDE to use GtkPaned to be able to bind the two widgets (an IDE may 57 | * want to use something else than a GtkPaned). 58 | */ 59 | _dh_util_bind_sidebar_and_notebook (sidebar, notebook); 60 | } 61 | -------------------------------------------------------------------------------- /devhelp/dh-application-window.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_APPLICATION_WINDOW_H 7 | #define DH_APPLICATION_WINDOW_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | void dh_application_window_bind_sidebar_and_notebook (DhSidebar *sidebar, 16 | DhNotebook *notebook); 17 | 18 | G_END_DECLS 19 | 20 | #endif /* DH_APPLICATION_WINDOW_H */ 21 | -------------------------------------------------------------------------------- /devhelp/dh-assistant-view.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2008 Sven Herzberg 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_ASSISTANT_VIEW_H 7 | #define DH_ASSISTANT_VIEW_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_ASSISTANT_VIEW (dh_assistant_view_get_type ()) 15 | #define DH_ASSISTANT_VIEW(i) (G_TYPE_CHECK_INSTANCE_CAST ((i), DH_TYPE_ASSISTANT_VIEW, DhAssistantView)) 16 | #define DH_ASSISTANT_VIEW_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), DH_TYPE_ASSISTANT_VIEW, DhAssistantViewClass)) 17 | #define DH_IS_ASSISTANT_VIEW(i) (G_TYPE_CHECK_INSTANCE_TYPE ((i), DH_TYPE_ASSISTANT_VIEW)) 18 | #define DH_IS_ASSISTANT_VIEW_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), DH_ASSISTANT_VIEW)) 19 | #define DH_ASSISTANT_VIEW_GET_CLASS(i) (G_TYPE_INSTANCE_GET_CLASS ((i), DH_TYPE_ASSISTANT_VIEW, DhAssistantView)) 20 | 21 | typedef struct _DhAssistantView DhAssistantView; 22 | typedef struct _DhAssistantViewClass DhAssistantViewClass; 23 | 24 | struct _DhAssistantView { 25 | WebKitWebView parent_instance; 26 | }; 27 | 28 | struct _DhAssistantViewClass { 29 | WebKitWebViewClass parent_class; 30 | 31 | /* Padding for future expansion */ 32 | gpointer padding[12]; 33 | }; 34 | 35 | GType dh_assistant_view_get_type (void) G_GNUC_CONST; 36 | 37 | GtkWidget * dh_assistant_view_new (void); 38 | 39 | gboolean dh_assistant_view_set_link (DhAssistantView *view, 40 | DhLink *link); 41 | 42 | gboolean dh_assistant_view_search (DhAssistantView *view, 43 | const gchar *str); 44 | 45 | G_END_DECLS 46 | 47 | #endif /* DH_ASSISTANT_VIEW_H */ 48 | -------------------------------------------------------------------------------- /devhelp/dh-book-list-builder.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_BOOK_LIST_BUILDER_H 7 | #define DH_BOOK_LIST_BUILDER_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | #define DH_TYPE_BOOK_LIST_BUILDER (dh_book_list_builder_get_type ()) 16 | #define DH_BOOK_LIST_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_BOOK_LIST_BUILDER, DhBookListBuilder)) 17 | #define DH_BOOK_LIST_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_BOOK_LIST_BUILDER, DhBookListBuilderClass)) 18 | #define DH_IS_BOOK_LIST_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_BOOK_LIST_BUILDER)) 19 | #define DH_IS_BOOK_LIST_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_BOOK_LIST_BUILDER)) 20 | #define DH_BOOK_LIST_BUILDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_BOOK_LIST_BUILDER, DhBookListBuilderClass)) 21 | 22 | typedef struct _DhBookListBuilder DhBookListBuilder; 23 | typedef struct _DhBookListBuilderClass DhBookListBuilderClass; 24 | typedef struct _DhBookListBuilderPrivate DhBookListBuilderPrivate; 25 | 26 | struct _DhBookListBuilder { 27 | GObject parent; 28 | 29 | DhBookListBuilderPrivate *priv; 30 | }; 31 | 32 | struct _DhBookListBuilderClass { 33 | GObjectClass parent_class; 34 | 35 | /* Padding for future expansion */ 36 | gpointer padding[12]; 37 | }; 38 | 39 | GType dh_book_list_builder_get_type (void); 40 | 41 | DhBookListBuilder * 42 | dh_book_list_builder_new (void); 43 | 44 | void dh_book_list_builder_add_sub_book_list (DhBookListBuilder *builder, 45 | DhBookList *sub_book_list); 46 | 47 | void dh_book_list_builder_add_default_sub_book_lists (DhBookListBuilder *builder); 48 | 49 | void dh_book_list_builder_read_books_disabled_setting (DhBookListBuilder *builder, 50 | DhSettings *settings); 51 | 52 | DhBookList * dh_book_list_builder_create_object (DhBookListBuilder *builder); 53 | 54 | G_END_DECLS 55 | 56 | #endif /* DH_BOOK_LIST_BUILDER_H */ 57 | -------------------------------------------------------------------------------- /devhelp/dh-book-list-directory.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_BOOK_LIST_DIRECTORY_H 7 | #define DH_BOOK_LIST_DIRECTORY_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_BOOK_LIST_DIRECTORY (dh_book_list_directory_get_type ()) 15 | #define DH_BOOK_LIST_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_BOOK_LIST_DIRECTORY, DhBookListDirectory)) 16 | #define DH_BOOK_LIST_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_BOOK_LIST_DIRECTORY, DhBookListDirectoryClass)) 17 | #define DH_IS_BOOK_LIST_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_BOOK_LIST_DIRECTORY)) 18 | #define DH_IS_BOOK_LIST_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_BOOK_LIST_DIRECTORY)) 19 | #define DH_BOOK_LIST_DIRECTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_BOOK_LIST_DIRECTORY, DhBookListDirectoryClass)) 20 | 21 | typedef struct _DhBookListDirectory DhBookListDirectory; 22 | typedef struct _DhBookListDirectoryClass DhBookListDirectoryClass; 23 | typedef struct _DhBookListDirectoryPrivate DhBookListDirectoryPrivate; 24 | 25 | struct _DhBookListDirectory { 26 | DhBookList parent; 27 | 28 | DhBookListDirectoryPrivate *priv; 29 | }; 30 | 31 | struct _DhBookListDirectoryClass { 32 | DhBookListClass parent_class; 33 | 34 | /* Padding for future expansion */ 35 | gpointer padding[12]; 36 | }; 37 | 38 | GType dh_book_list_directory_get_type (void); 39 | 40 | DhBookListDirectory * dh_book_list_directory_new (GFile *directory); 41 | 42 | GFile * dh_book_list_directory_get_directory (DhBookListDirectory *list_directory); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* DH_BOOK_LIST_DIRECTORY_H */ 47 | -------------------------------------------------------------------------------- /devhelp/dh-book-list-simple.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_BOOK_LIST_SIMPLE_H 7 | #define DH_BOOK_LIST_SIMPLE_H 8 | 9 | #include 10 | #include "dh-book-list.h" 11 | #include "dh-settings.h" 12 | 13 | G_BEGIN_DECLS 14 | 15 | #define DH_TYPE_BOOK_LIST_SIMPLE (_dh_book_list_simple_get_type ()) 16 | #define DH_BOOK_LIST_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_BOOK_LIST_SIMPLE, DhBookListSimple)) 17 | #define DH_BOOK_LIST_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_BOOK_LIST_SIMPLE, DhBookListSimpleClass)) 18 | #define DH_IS_BOOK_LIST_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_BOOK_LIST_SIMPLE)) 19 | #define DH_IS_BOOK_LIST_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_BOOK_LIST_SIMPLE)) 20 | #define DH_BOOK_LIST_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_BOOK_LIST_SIMPLE, DhBookListSimpleClass)) 21 | 22 | typedef struct _DhBookListSimple DhBookListSimple; 23 | typedef struct _DhBookListSimpleClass DhBookListSimpleClass; 24 | typedef struct _DhBookListSimplePrivate DhBookListSimplePrivate; 25 | 26 | struct _DhBookListSimple { 27 | DhBookList parent; 28 | 29 | DhBookListSimplePrivate *priv; 30 | }; 31 | 32 | struct _DhBookListSimpleClass { 33 | DhBookListClass parent_class; 34 | 35 | /* Padding for future expansion */ 36 | gpointer padding[12]; 37 | }; 38 | 39 | G_GNUC_INTERNAL 40 | GType _dh_book_list_simple_get_type (void); 41 | 42 | G_GNUC_INTERNAL 43 | DhBookList * _dh_book_list_simple_new (GList *sub_book_lists, 44 | DhSettings *settings); 45 | 46 | G_END_DECLS 47 | 48 | #endif /* DH_BOOK_LIST_SIMPLE_H */ 49 | -------------------------------------------------------------------------------- /devhelp/dh-book-list.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_BOOK_LIST_H 7 | #define DH_BOOK_LIST_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_BOOK_LIST (dh_book_list_get_type ()) 15 | #define DH_BOOK_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_BOOK_LIST, DhBookList)) 16 | #define DH_BOOK_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_BOOK_LIST, DhBookListClass)) 17 | #define DH_IS_BOOK_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_BOOK_LIST)) 18 | #define DH_IS_BOOK_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_BOOK_LIST)) 19 | #define DH_BOOK_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_BOOK_LIST, DhBookListClass)) 20 | 21 | typedef struct _DhBookList DhBookList; 22 | typedef struct _DhBookListClass DhBookListClass; 23 | typedef struct _DhBookListPrivate DhBookListPrivate; 24 | 25 | struct _DhBookList { 26 | GObject parent; 27 | 28 | DhBookListPrivate *priv; 29 | }; 30 | 31 | /** 32 | * DhBookListClass: 33 | * @parent_class: The parent class. 34 | * @add_book: Virtual function pointer for the #DhBookList::add-book signal. 35 | * @remove_book: Virtual function pointer for the #DhBookList::remove-book 36 | * signal. 37 | * @get_books: Virtual function pointer for dh_book_list_get_books(). Returns 38 | * the #DhBookList internal #GList by default. If you override this vfunc 39 | * ensure that each book ID is unique in the returned list. 40 | */ 41 | struct _DhBookListClass { 42 | GObjectClass parent_class; 43 | 44 | /* Signals */ 45 | void (* add_book) (DhBookList *book_list, 46 | DhBook *book); 47 | 48 | void (* remove_book) (DhBookList *book_list, 49 | DhBook *book); 50 | 51 | /* Vfuncs */ 52 | GList * (* get_books) (DhBookList *book_list); 53 | 54 | /*< private >*/ 55 | 56 | /* Padding for future expansion */ 57 | gpointer padding[12]; 58 | }; 59 | 60 | GType dh_book_list_get_type (void); 61 | 62 | DhBookList * dh_book_list_new (void); 63 | 64 | DhBookList * dh_book_list_get_default (void); 65 | 66 | G_GNUC_INTERNAL 67 | void _dh_book_list_unref_default (void); 68 | 69 | GList * dh_book_list_get_books (DhBookList *book_list); 70 | 71 | void dh_book_list_add_book (DhBookList *book_list, 72 | DhBook *book); 73 | 74 | void dh_book_list_remove_book (DhBookList *book_list, 75 | DhBook *book); 76 | 77 | G_END_DECLS 78 | 79 | #endif /* DH_BOOK_LIST_H */ 80 | -------------------------------------------------------------------------------- /devhelp/dh-book-manager.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2002 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2002 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2004-2008 Imendio AB 5 | * SPDX-FileCopyrightText: 2010 Lanedo GmbH 6 | * SPDX-FileCopyrightText: 2012 Thomas Bechtold 7 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 8 | * SPDX-License-Identifier: GPL-3.0-or-later 9 | */ 10 | 11 | #include "dh-book-manager.h" 12 | 13 | /** 14 | * SECTION:dh-book-manager 15 | * @Title: DhBookManager 16 | * @Short_description: Aggregation of all #DhBook's 17 | * 18 | * #DhBookManager was a singleton class containing all the #DhBook's. It is now 19 | * empty. 20 | * 21 | * 22 | * This class is entirely deprecated, you need to use #DhProfile, #DhSettings 23 | * and #DhBookList instead. 24 | * 25 | */ 26 | 27 | G_DEFINE_TYPE (DhBookManager, dh_book_manager, G_TYPE_OBJECT); 28 | 29 | static void 30 | dh_book_manager_class_init (DhBookManagerClass *klass) 31 | { 32 | } 33 | 34 | static void 35 | dh_book_manager_init (DhBookManager *book_manager) 36 | { 37 | } 38 | 39 | /** 40 | * dh_book_manager_new: 41 | * 42 | * Returns: (transfer full): a new #DhBookManager object. 43 | * Deprecated: 3.26: the #DhBookManager class is deprecated. 44 | */ 45 | DhBookManager * 46 | dh_book_manager_new (void) 47 | { 48 | return g_object_new (DH_TYPE_BOOK_MANAGER, NULL); 49 | } 50 | 51 | /** 52 | * dh_book_manager_populate: 53 | * @book_manager: a #DhBookManager. 54 | * 55 | * Deprecated: 3.26: the #DhBookManager class is deprecated. 56 | */ 57 | void 58 | dh_book_manager_populate (DhBookManager *book_manager) 59 | { 60 | } 61 | -------------------------------------------------------------------------------- /devhelp/dh-book-manager.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2010 Lanedo GmbH 3 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #ifndef DH_BOOK_MANAGER_H 8 | #define DH_BOOK_MANAGER_H 9 | 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | typedef struct _DhBookManager DhBookManager; 15 | typedef struct _DhBookManagerClass DhBookManagerClass; 16 | 17 | #define DH_TYPE_BOOK_MANAGER (dh_book_manager_get_type ()) 18 | #define DH_BOOK_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DH_TYPE_BOOK_MANAGER, DhBookManager)) 19 | #define DH_BOOK_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DH_TYPE_BOOK_MANAGER, DhBookManagerClass)) 20 | #define DH_IS_BOOK_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DH_TYPE_BOOK_MANAGER)) 21 | #define DH_IS_BOOK_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DH_TYPE_BOOK_MANAGER)) 22 | #define DH_BOOK_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DH_TYPE_BOOK_MANAGER, DhBookManagerClass)) 23 | 24 | struct _DhBookManager { 25 | GObject parent_instance; 26 | }; 27 | 28 | struct _DhBookManagerClass { 29 | GObjectClass parent_class; 30 | 31 | /* Padding for future expansion */ 32 | gpointer padding[12]; 33 | }; 34 | 35 | GType dh_book_manager_get_type (void) G_GNUC_CONST; 36 | 37 | G_DEPRECATED 38 | DhBookManager * dh_book_manager_new (void); 39 | 40 | G_DEPRECATED 41 | void dh_book_manager_populate (DhBookManager *book_manager); 42 | 43 | G_END_DECLS 44 | 45 | #endif /* DH_BOOK_MANAGER_H */ 46 | -------------------------------------------------------------------------------- /devhelp/dh-book-tree.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2001 Mikael Hallendal 3 | * SPDX-FileCopyrightText: 2018 Sébastien Wilmet 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #ifndef DH_BOOK_TREE_H 8 | #define DH_BOOK_TREE_H 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | G_BEGIN_DECLS 15 | 16 | #define DH_TYPE_BOOK_TREE (dh_book_tree_get_type ()) 17 | #define DH_BOOK_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_BOOK_TREE, DhBookTree)) 18 | #define DH_BOOK_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_BOOK_TREE, DhBookTreeClass)) 19 | #define DH_IS_BOOK_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_BOOK_TREE)) 20 | #define DH_IS_BOOK_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), DH_TYPE_BOOK_TREE)) 21 | 22 | typedef struct _DhBookTree DhBookTree; 23 | typedef struct _DhBookTreeClass DhBookTreeClass; 24 | 25 | struct _DhBookTree { 26 | GtkTreeView parent_instance; 27 | }; 28 | 29 | struct _DhBookTreeClass { 30 | GtkTreeViewClass parent_class; 31 | 32 | /* Padding for future expansion */ 33 | gpointer padding[12]; 34 | }; 35 | 36 | GType dh_book_tree_get_type (void) G_GNUC_CONST; 37 | 38 | DhBookTree * dh_book_tree_new (DhProfile *profile); 39 | 40 | DhProfile * dh_book_tree_get_profile (DhBookTree *tree); 41 | 42 | DhLink * dh_book_tree_get_selected_link (DhBookTree *tree); 43 | 44 | void dh_book_tree_select_uri (DhBookTree *tree, 45 | const gchar *uri); 46 | 47 | G_END_DECLS 48 | 49 | #endif /* DH_BOOK_TREE_H */ 50 | -------------------------------------------------------------------------------- /devhelp/dh-book.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2002 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2002 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2005-2008 Imendio AB 5 | * SPDX-FileCopyrightText: 2010 Lanedo GmbH 6 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 7 | * SPDX-License-Identifier: GPL-3.0-or-later 8 | */ 9 | 10 | #ifndef DH_BOOK_H 11 | #define DH_BOOK_H 12 | 13 | #include 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | typedef struct _DhBook DhBook; 19 | typedef struct _DhBookClass DhBookClass; 20 | 21 | #define DH_TYPE_BOOK (dh_book_get_type ()) 22 | #define DH_BOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DH_TYPE_BOOK, DhBook)) 23 | #define DH_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DH_TYPE_BOOK, DhBookClass)) 24 | #define DH_IS_BOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DH_TYPE_BOOK)) 25 | #define DH_IS_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DH_TYPE_BOOK)) 26 | #define DH_BOOK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DH_TYPE_BOOK, DhBookClass)) 27 | 28 | struct _DhBook { 29 | GObject parent_instance; 30 | }; 31 | 32 | struct _DhBookClass { 33 | GObjectClass parent_class; 34 | 35 | /* Padding for future expansion */ 36 | gpointer padding[12]; 37 | }; 38 | 39 | GType dh_book_get_type (void) G_GNUC_CONST; 40 | 41 | DhBook * dh_book_new (GFile *index_file); 42 | 43 | GFile * dh_book_get_index_file (DhBook *book); 44 | 45 | const gchar *dh_book_get_id (DhBook *book); 46 | 47 | const gchar *dh_book_get_title (DhBook *book); 48 | 49 | const gchar *dh_book_get_language (DhBook *book); 50 | 51 | GList * dh_book_get_links (DhBook *book); 52 | 53 | GNode * dh_book_get_tree (DhBook *book); 54 | 55 | DhCompletion *dh_book_get_completion (DhBook *book); 56 | 57 | gint dh_book_cmp_by_id (DhBook *a, 58 | DhBook *b); 59 | 60 | gint dh_book_cmp_by_title (DhBook *a, 61 | DhBook *b); 62 | 63 | G_END_DECLS 64 | 65 | #endif /* DH_BOOK_H */ 66 | -------------------------------------------------------------------------------- /devhelp/dh-completion.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_COMPLETION_H 7 | #define DH_COMPLETION_H 8 | 9 | #include 10 | 11 | G_BEGIN_DECLS 12 | 13 | #define DH_TYPE_COMPLETION (dh_completion_get_type ()) 14 | #define DH_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_COMPLETION, DhCompletion)) 15 | #define DH_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_COMPLETION, DhCompletionClass)) 16 | #define DH_IS_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_COMPLETION)) 17 | #define DH_IS_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_COMPLETION)) 18 | #define DH_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_COMPLETION, DhCompletionClass)) 19 | 20 | typedef struct _DhCompletion DhCompletion; 21 | typedef struct _DhCompletionClass DhCompletionClass; 22 | typedef struct _DhCompletionPrivate DhCompletionPrivate; 23 | 24 | struct _DhCompletion { 25 | GObject parent; 26 | 27 | DhCompletionPrivate *priv; 28 | }; 29 | 30 | struct _DhCompletionClass { 31 | GObjectClass parent_class; 32 | 33 | /* Padding for future expansion */ 34 | gpointer padding[12]; 35 | }; 36 | 37 | GType dh_completion_get_type (void); 38 | 39 | DhCompletion * dh_completion_new (void); 40 | 41 | void dh_completion_add_string (DhCompletion *completion, 42 | const gchar *str); 43 | 44 | void dh_completion_sort (DhCompletion *completion); 45 | 46 | gchar * dh_completion_complete (DhCompletion *completion, 47 | const gchar *prefix); 48 | 49 | gchar * dh_completion_aggregate_complete (GList *completion_objects, 50 | const gchar *prefix); 51 | 52 | G_END_DECLS 53 | 54 | #endif /* DH_COMPLETION_H */ 55 | -------------------------------------------------------------------------------- /devhelp/dh-error.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2002 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2002 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2018 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #include "dh-error.h" 9 | 10 | GQuark 11 | _dh_error_quark (void) 12 | { 13 | static GQuark quark = 0; 14 | 15 | if (quark == 0) 16 | quark = g_quark_from_static_string ("libdevhelp-error-quark"); 17 | 18 | return quark; 19 | } 20 | -------------------------------------------------------------------------------- /devhelp/dh-error.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2002 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2002 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2018 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #ifndef DH_ERROR_H 9 | #define DH_ERROR_H 10 | 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | #define DH_ERROR _dh_error_quark () 16 | 17 | typedef enum { 18 | DH_ERROR_MALFORMED_BOOK 19 | } DhError; 20 | 21 | G_GNUC_INTERNAL 22 | GQuark _dh_error_quark (void); 23 | 24 | G_END_DECLS 25 | 26 | #endif /* DH_ERROR_H */ 27 | -------------------------------------------------------------------------------- /devhelp/dh-init.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2012 Aleksander Morgado 3 | * SPDX-FileCopyrightText: 2017-2020 Sébastien Wilmet 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #include "config.h" 8 | #include "dh-init.h" 9 | #include 10 | #include 11 | #include "dh-book-list.h" 12 | #include "dh-profile.h" 13 | #include "dh-settings.h" 14 | 15 | /** 16 | * dh_init: 17 | * 18 | * Initializes the Devhelp library (e.g. for the internationalization). 19 | * 20 | * This function can be called several times, but is meant to be called at the 21 | * beginning of main(), before any other Devhelp function call. 22 | * 23 | * Since version 3.38, this function enables the WebKitGTK sandbox by calling 24 | * webkit_web_context_set_sandbox_enabled() on the default #WebKitWebContext. 25 | */ 26 | void 27 | dh_init (void) 28 | { 29 | static gboolean done = FALSE; 30 | 31 | if (!done) { 32 | WebKitWebContext *webkit_context; 33 | 34 | bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); 35 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); 36 | 37 | webkit_context = webkit_web_context_get_default (); 38 | webkit_web_context_set_sandbox_enabled (webkit_context, TRUE); 39 | 40 | done = TRUE; 41 | } 42 | } 43 | 44 | /** 45 | * dh_finalize: 46 | * 47 | * Free the resources allocated by Devhelp. For example it unrefs the singleton 48 | * objects. 49 | * 50 | * It is not mandatory to call this function, it's just to be friendlier to 51 | * memory debugging tools. This function is meant to be called at the end of 52 | * main(). It can be called several times. 53 | * 54 | * Since: 3.26 55 | */ 56 | 57 | /* Another way is to use a DSO destructor, see gconstructor.h in GLib. 58 | * 59 | * The advantage of calling dh_finalize() at the end of main() is that 60 | * gobject-list [1] correctly reports that all Dh* objects have been finalized 61 | * when quitting the application. On the other hand a DSO destructor runs after 62 | * the gobject-list's last output, so it's much less convenient, see: 63 | * https://gitlab.gnome.org/GNOME/gtksourceview/commit/e761de9c2bee90c232875bbc41e6e73e1f63e145 64 | * 65 | * [1] A tool for debugging the lifetime of GObjects: 66 | * https://github.com/danni/gobject-list 67 | */ 68 | void 69 | dh_finalize (void) 70 | { 71 | static gboolean done = FALSE; 72 | 73 | /* Unref the singletons only once, even if this function is called 74 | * multiple times, to see if a reference is not released correctly. 75 | * Normally the singletons have a ref count of 1. If for some reason the 76 | * ref count is increased somewhere, it needs to be decreased 77 | * accordingly, at the right place. 78 | */ 79 | if (!done) { 80 | _dh_book_list_unref_default (); 81 | _dh_profile_unref_default (); 82 | _dh_settings_unref_default (); 83 | done = TRUE; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /devhelp/dh-init.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2017 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_INIT_H 7 | #define DH_INIT_H 8 | 9 | #include 10 | 11 | G_BEGIN_DECLS 12 | 13 | void dh_init (void); 14 | void dh_finalize (void); 15 | 16 | G_END_DECLS 17 | 18 | #endif /* DH_INIT_H */ 19 | -------------------------------------------------------------------------------- /devhelp/dh-keyword-model.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2002 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2002 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2018 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #ifndef DH_KEYWORD_MODEL_H 9 | #define DH_KEYWORD_MODEL_H 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define DH_TYPE_KEYWORD_MODEL (dh_keyword_model_get_type ()) 18 | #define DH_KEYWORD_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_KEYWORD_MODEL, DhKeywordModel)) 19 | #define DH_KEYWORD_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_KEYWORD_MODEL, DhKeywordModelClass)) 20 | #define DH_IS_KEYWORD_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_KEYWORD_MODEL)) 21 | #define DH_IS_KEYWORD_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_KEYWORD_MODEL)) 22 | #define DH_KEYWORD_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_KEYWORD_MODEL, DhKeywordModelClass)) 23 | 24 | typedef struct _DhKeywordModel DhKeywordModel; 25 | typedef struct _DhKeywordModelClass DhKeywordModelClass; 26 | 27 | struct _DhKeywordModel { 28 | GObject parent_instance; 29 | }; 30 | 31 | struct _DhKeywordModelClass { 32 | GObjectClass parent_class; 33 | 34 | /* Padding for future expansion */ 35 | gpointer padding[12]; 36 | }; 37 | 38 | enum { 39 | DH_KEYWORD_MODEL_COL_NAME, 40 | DH_KEYWORD_MODEL_COL_LINK, 41 | DH_KEYWORD_MODEL_COL_CURRENT_BOOK_FLAG, 42 | DH_KEYWORD_MODEL_NUM_COLS 43 | }; 44 | 45 | GType dh_keyword_model_get_type (void); 46 | 47 | DhKeywordModel *dh_keyword_model_new (void); 48 | 49 | DhLink * dh_keyword_model_filter (DhKeywordModel *model, 50 | const gchar *search_string, 51 | const gchar *current_book_id, 52 | DhProfile *profile); 53 | 54 | G_END_DECLS 55 | 56 | #endif /* DH_KEYWORD_MODEL_H */ 57 | -------------------------------------------------------------------------------- /devhelp/dh-link.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2002 Mikael Hallendal 3 | * SPDX-FileCopyrightText: 2008 Imendio AB 4 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #ifndef DH_LINK_H 9 | #define DH_LINK_H 10 | 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | /** 16 | * DhLinkType: 17 | * @DH_LINK_TYPE_BOOK: The top-level page of a #DhBook. 18 | * @DH_LINK_TYPE_PAGE: A page. 19 | * @DH_LINK_TYPE_KEYWORD: Another kind of keyword. 20 | * @DH_LINK_TYPE_FUNCTION: A function keyword. 21 | * @DH_LINK_TYPE_STRUCT: A struct keyword. 22 | * @DH_LINK_TYPE_MACRO: A macro keyword. 23 | * @DH_LINK_TYPE_ENUM: An enum keyword. 24 | * @DH_LINK_TYPE_TYPEDEF: A typedef keyword. 25 | * @DH_LINK_TYPE_PROPERTY: A property keyword. 26 | * @DH_LINK_TYPE_SIGNAL: A signal keyword. 27 | * 28 | * The type of the content the link points to. 29 | */ 30 | typedef enum { 31 | DH_LINK_TYPE_BOOK, 32 | DH_LINK_TYPE_PAGE, 33 | DH_LINK_TYPE_KEYWORD, 34 | DH_LINK_TYPE_FUNCTION, 35 | DH_LINK_TYPE_STRUCT, 36 | DH_LINK_TYPE_MACRO, 37 | DH_LINK_TYPE_ENUM, 38 | DH_LINK_TYPE_TYPEDEF, 39 | DH_LINK_TYPE_PROPERTY, 40 | DH_LINK_TYPE_SIGNAL 41 | } DhLinkType; 42 | 43 | /** 44 | * DhLinkFlags: 45 | * @DH_LINK_FLAGS_NONE: No flags set. 46 | * @DH_LINK_FLAGS_DEPRECATED: The symbol that the link points to is deprecated. 47 | */ 48 | typedef enum { 49 | DH_LINK_FLAGS_NONE = 0, 50 | DH_LINK_FLAGS_DEPRECATED = 1 << 0 51 | } DhLinkFlags; 52 | 53 | typedef struct _DhLink DhLink; 54 | 55 | #define DH_TYPE_LINK (dh_link_get_type ()) 56 | 57 | GType dh_link_get_type (void); 58 | 59 | DhLink * dh_link_new_book (const gchar *base_path, 60 | const gchar *book_id, 61 | const gchar *book_title, 62 | const gchar *relative_url); 63 | 64 | DhLink * dh_link_new (DhLinkType type, 65 | DhLink *book_link, 66 | const gchar *name, 67 | const gchar *relative_url); 68 | 69 | DhLink * dh_link_ref (DhLink *link); 70 | 71 | void dh_link_unref (DhLink *link); 72 | 73 | DhLinkType dh_link_get_link_type (DhLink *link); 74 | 75 | DhLinkFlags dh_link_get_flags (DhLink *link); 76 | 77 | void dh_link_set_flags (DhLink *link, 78 | DhLinkFlags flags); 79 | 80 | const gchar *dh_link_get_name (DhLink *link); 81 | 82 | gboolean dh_link_match_relative_url (DhLink *link, 83 | const gchar *relative_url); 84 | 85 | gboolean dh_link_belongs_to_page (DhLink *link, 86 | const gchar *page_id); 87 | 88 | gchar * dh_link_get_uri (DhLink *link); 89 | 90 | const gchar *dh_link_get_book_title (DhLink *link); 91 | 92 | const gchar *dh_link_get_book_id (DhLink *link); 93 | 94 | gint dh_link_compare (gconstpointer a, 95 | gconstpointer b); 96 | 97 | const gchar *dh_link_type_to_string (DhLinkType link_type); 98 | 99 | G_END_DECLS 100 | 101 | #endif /* DH_LINK_H */ 102 | -------------------------------------------------------------------------------- /devhelp/dh-notebook.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_NOTEBOOK_H 7 | #define DH_NOTEBOOK_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | G_BEGIN_DECLS 15 | 16 | #define DH_TYPE_NOTEBOOK (dh_notebook_get_type ()) 17 | #define DH_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_NOTEBOOK, DhNotebook)) 18 | #define DH_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_NOTEBOOK, DhNotebookClass)) 19 | #define DH_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_NOTEBOOK)) 20 | #define DH_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_NOTEBOOK)) 21 | #define DH_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_NOTEBOOK, DhNotebookClass)) 22 | 23 | typedef struct _DhNotebook DhNotebook; 24 | typedef struct _DhNotebookClass DhNotebookClass; 25 | typedef struct _DhNotebookPrivate DhNotebookPrivate; 26 | 27 | struct _DhNotebook { 28 | GtkNotebook parent; 29 | 30 | DhNotebookPrivate *priv; 31 | }; 32 | 33 | struct _DhNotebookClass { 34 | GtkNotebookClass parent_class; 35 | 36 | /* Padding for future expansion */ 37 | gpointer padding[12]; 38 | }; 39 | 40 | GType dh_notebook_get_type (void); 41 | 42 | DhNotebook * dh_notebook_new (DhProfile *profile); 43 | 44 | DhProfile * dh_notebook_get_profile (DhNotebook *notebook); 45 | 46 | void dh_notebook_open_new_tab (DhNotebook *notebook, 47 | const gchar *uri, 48 | gboolean switch_focus); 49 | 50 | DhTab * dh_notebook_get_active_tab (DhNotebook *notebook); 51 | 52 | DhWebView * dh_notebook_get_active_web_view (DhNotebook *notebook); 53 | 54 | GList * dh_notebook_get_all_web_views (DhNotebook *notebook); 55 | 56 | G_END_DECLS 57 | 58 | #endif /* DH_NOTEBOOK_H */ 59 | -------------------------------------------------------------------------------- /devhelp/dh-parser.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2003 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2003 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #ifndef DH_PARSER_H 9 | #define DH_PARSER_H 10 | 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | G_GNUC_INTERNAL 16 | gboolean _dh_parser_read_file (GFile *index_file, 17 | gchar **book_title, 18 | gchar **book_id, 19 | gchar **book_language, 20 | GNode **book_tree, 21 | GList **all_links, 22 | GError **error); 23 | 24 | G_END_DECLS 25 | 26 | #endif /* DH_PARSER_H */ 27 | -------------------------------------------------------------------------------- /devhelp/dh-profile-builder.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #include "dh-profile-builder.h" 7 | 8 | /** 9 | * SECTION:dh-profile-builder 10 | * @Title: DhProfileBuilder 11 | * @Short_description: Builds #DhProfile objects 12 | * 13 | * #DhProfileBuilder permits to build #DhProfile objects. 14 | */ 15 | 16 | /* API design: 17 | * 18 | * It follows the builder pattern, see: 19 | * https://blogs.gnome.org/otte/2018/02/03/builders/ 20 | * but it is implemented in a simpler way, to have less boilerplate. 21 | */ 22 | 23 | struct _DhProfileBuilderPrivate { 24 | DhSettings *settings; 25 | DhBookList *book_list; 26 | }; 27 | 28 | G_DEFINE_TYPE_WITH_PRIVATE (DhProfileBuilder, dh_profile_builder, G_TYPE_OBJECT) 29 | 30 | static void 31 | dh_profile_builder_dispose (GObject *object) 32 | { 33 | DhProfileBuilder *builder = DH_PROFILE_BUILDER (object); 34 | 35 | g_clear_object (&builder->priv->settings); 36 | g_clear_object (&builder->priv->book_list); 37 | 38 | G_OBJECT_CLASS (dh_profile_builder_parent_class)->dispose (object); 39 | } 40 | 41 | static void 42 | dh_profile_builder_class_init (DhProfileBuilderClass *klass) 43 | { 44 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 45 | 46 | object_class->dispose = dh_profile_builder_dispose; 47 | } 48 | 49 | static void 50 | dh_profile_builder_init (DhProfileBuilder *builder) 51 | { 52 | builder->priv = dh_profile_builder_get_instance_private (builder); 53 | } 54 | 55 | /** 56 | * dh_profile_builder_new: 57 | * 58 | * Returns: (transfer full): a new #DhProfileBuilder. 59 | * Since: 3.30 60 | */ 61 | DhProfileBuilder * 62 | dh_profile_builder_new (void) 63 | { 64 | return g_object_new (DH_TYPE_PROFILE_BUILDER, NULL); 65 | } 66 | 67 | /** 68 | * dh_profile_builder_set_settings: 69 | * @builder: a #DhProfileBuilder. 70 | * @settings: a #DhSettings. 71 | * 72 | * Sets the #DhSettings object. 73 | * 74 | * If you don't call this function, the default #DhSettings object as returned 75 | * by dh_settings_get_default() will be used. 76 | * 77 | * Since: 3.30 78 | */ 79 | void 80 | dh_profile_builder_set_settings (DhProfileBuilder *builder, 81 | DhSettings *settings) 82 | { 83 | g_return_if_fail (DH_IS_PROFILE_BUILDER (builder)); 84 | g_return_if_fail (DH_IS_SETTINGS (settings)); 85 | 86 | g_set_object (&builder->priv->settings, settings); 87 | } 88 | 89 | /** 90 | * dh_profile_builder_set_book_list: 91 | * @builder: a #DhProfileBuilder. 92 | * @book_list: a #DhBookList. 93 | * 94 | * Sets the #DhBookList object. 95 | * 96 | * If you don't call this function, the default #DhBookList object as returned 97 | * by dh_book_list_get_default() will be used. 98 | * 99 | * Since: 3.30 100 | */ 101 | void 102 | dh_profile_builder_set_book_list (DhProfileBuilder *builder, 103 | DhBookList *book_list) 104 | { 105 | g_return_if_fail (DH_IS_PROFILE_BUILDER (builder)); 106 | g_return_if_fail (DH_IS_BOOK_LIST (book_list)); 107 | 108 | g_set_object (&builder->priv->book_list, book_list); 109 | } 110 | 111 | /** 112 | * dh_profile_builder_create_object: 113 | * @builder: a #DhProfileBuilder. 114 | * 115 | * Returns: (transfer full): the newly created #DhProfile object. 116 | * Since: 3.30 117 | */ 118 | DhProfile * 119 | dh_profile_builder_create_object (DhProfileBuilder *builder) 120 | { 121 | g_return_val_if_fail (DH_IS_PROFILE_BUILDER (builder), NULL); 122 | 123 | /* Set default values if needed. 124 | * Use all the set functions to test them, to have the same code paths 125 | * as if the set functions were already called. 126 | */ 127 | if (builder->priv->settings == NULL) 128 | dh_profile_builder_set_settings (builder, dh_settings_get_default ()); 129 | 130 | if (builder->priv->book_list == NULL) 131 | dh_profile_builder_set_book_list (builder, dh_book_list_get_default ()); 132 | 133 | return _dh_profile_new (builder->priv->settings, 134 | builder->priv->book_list); 135 | } 136 | -------------------------------------------------------------------------------- /devhelp/dh-profile-builder.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_PROFILE_BUILDER_H 7 | #define DH_PROFILE_BUILDER_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | G_BEGIN_DECLS 15 | 16 | #define DH_TYPE_PROFILE_BUILDER (dh_profile_builder_get_type ()) 17 | #define DH_PROFILE_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_PROFILE_BUILDER, DhProfileBuilder)) 18 | #define DH_PROFILE_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_PROFILE_BUILDER, DhProfileBuilderClass)) 19 | #define DH_IS_PROFILE_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_PROFILE_BUILDER)) 20 | #define DH_IS_PROFILE_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_PROFILE_BUILDER)) 21 | #define DH_PROFILE_BUILDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_PROFILE_BUILDER, DhProfileBuilderClass)) 22 | 23 | typedef struct _DhProfileBuilder DhProfileBuilder; 24 | typedef struct _DhProfileBuilderClass DhProfileBuilderClass; 25 | typedef struct _DhProfileBuilderPrivate DhProfileBuilderPrivate; 26 | 27 | struct _DhProfileBuilder { 28 | GObject parent; 29 | 30 | DhProfileBuilderPrivate *priv; 31 | }; 32 | 33 | struct _DhProfileBuilderClass { 34 | GObjectClass parent_class; 35 | 36 | /* Padding for future expansion */ 37 | gpointer padding[12]; 38 | }; 39 | 40 | GType dh_profile_builder_get_type (void); 41 | 42 | DhProfileBuilder * dh_profile_builder_new (void); 43 | 44 | void dh_profile_builder_set_settings (DhProfileBuilder *builder, 45 | DhSettings *settings); 46 | 47 | void dh_profile_builder_set_book_list (DhProfileBuilder *builder, 48 | DhBookList *book_list); 49 | 50 | DhProfile * dh_profile_builder_create_object (DhProfileBuilder *builder); 51 | 52 | G_END_DECLS 53 | 54 | #endif /* DH_PROFILE_BUILDER_H */ 55 | -------------------------------------------------------------------------------- /devhelp/dh-profile.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #include "dh-profile.h" 7 | #include "dh-profile-builder.h" 8 | 9 | /** 10 | * SECTION:dh-profile 11 | * @Title: DhProfile 12 | * @Short_description: libdevhelp profile 13 | * 14 | * #DhProfile permits to configure other libdevhelp objects. For example 15 | * #DhSidebar has the #DhSidebar:profile construct-only property. A #DhProfile 16 | * contains a #DhSettings object and a #DhBookList object. As a convention for 17 | * other libdevhelp classes that use #DhProfile, if the #DhProfile is not 18 | * provided (i.e. it is set to %NULL), then the default profile is used, see 19 | * dh_profile_get_default(). 20 | * 21 | * There is the possibility to run in parallel multiple profiles in the same 22 | * process, for example: 23 | * - In an IDE for different projects or different programming languages. 24 | * - In different #GtkWindow's of the API browser application. 25 | * 26 | * With #DhSettings it's possible to share some #GSettings keys between 27 | * different profiles. 28 | * 29 | * A possible use-case is to have one "generic" profile, which corresponds to 30 | * the default profile as returned by dh_profile_get_default(). And another 31 | * profile tailored to a specific development platform (for example GNOME), 32 | * providing additional features useful for that development platform (for 33 | * example to download the latest API documentation, have a start page, etc). 34 | */ 35 | 36 | struct _DhProfilePrivate { 37 | DhSettings *settings; 38 | DhBookList *book_list; 39 | }; 40 | 41 | static DhProfile *default_instance = NULL; 42 | 43 | G_DEFINE_TYPE_WITH_PRIVATE (DhProfile, dh_profile, G_TYPE_OBJECT) 44 | 45 | static void 46 | dh_profile_dispose (GObject *object) 47 | { 48 | DhProfile *profile = DH_PROFILE (object); 49 | 50 | g_clear_object (&profile->priv->settings); 51 | g_clear_object (&profile->priv->book_list); 52 | 53 | G_OBJECT_CLASS (dh_profile_parent_class)->dispose (object); 54 | } 55 | 56 | static void 57 | dh_profile_finalize (GObject *object) 58 | { 59 | if (default_instance == DH_PROFILE (object)) 60 | default_instance = NULL; 61 | 62 | G_OBJECT_CLASS (dh_profile_parent_class)->finalize (object); 63 | } 64 | 65 | static void 66 | dh_profile_class_init (DhProfileClass *klass) 67 | { 68 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 69 | 70 | object_class->dispose = dh_profile_dispose; 71 | object_class->finalize = dh_profile_finalize; 72 | } 73 | 74 | static void 75 | dh_profile_init (DhProfile *profile) 76 | { 77 | profile->priv = dh_profile_get_instance_private (profile); 78 | } 79 | 80 | DhProfile * 81 | _dh_profile_new (DhSettings *settings, 82 | DhBookList *book_list) 83 | { 84 | DhProfile *profile; 85 | 86 | g_return_val_if_fail (DH_IS_SETTINGS (settings), NULL); 87 | g_return_val_if_fail (DH_IS_BOOK_LIST (book_list), NULL); 88 | 89 | profile = g_object_new (DH_TYPE_PROFILE, NULL); 90 | profile->priv->settings = g_object_ref (settings); 91 | profile->priv->book_list = g_object_ref (book_list); 92 | 93 | return profile; 94 | } 95 | 96 | /** 97 | * dh_profile_get_default: 98 | * 99 | * Gets the default #DhProfile object. It has the default #DhSettings object as 100 | * returned by dh_settings_get_default(), and the default #DhBookList object as 101 | * returned by dh_book_list_get_default(). 102 | * 103 | * Returns: (transfer none): the default #DhProfile object. 104 | * Since: 3.30 105 | */ 106 | DhProfile * 107 | dh_profile_get_default (void) 108 | { 109 | if (default_instance == NULL) { 110 | DhProfileBuilder *builder; 111 | 112 | builder = dh_profile_builder_new (); 113 | default_instance = dh_profile_builder_create_object (builder); 114 | g_object_unref (builder); 115 | } 116 | 117 | return default_instance; 118 | } 119 | 120 | void 121 | _dh_profile_unref_default (void) 122 | { 123 | if (default_instance != NULL) 124 | g_object_unref (default_instance); 125 | 126 | /* default_instance is not set to NULL here, it is set to NULL in 127 | * dh_profile_finalize() (i.e. when we are sure that the ref count 128 | * reaches 0). 129 | */ 130 | } 131 | 132 | /** 133 | * dh_profile_get_settings: 134 | * @profile: a #DhProfile. 135 | * 136 | * Gets the #DhSettings object of @profile. The returned object is guaranteed to 137 | * be the same for the lifetime of @profile. 138 | * 139 | * Returns: (transfer none): the #DhSettings of @profile. 140 | * Since: 3.30 141 | */ 142 | DhSettings * 143 | dh_profile_get_settings (DhProfile *profile) 144 | { 145 | g_return_val_if_fail (DH_IS_PROFILE (profile), NULL); 146 | 147 | return profile->priv->settings; 148 | } 149 | 150 | /** 151 | * dh_profile_get_book_list: 152 | * @profile: a #DhProfile. 153 | * 154 | * Gets the #DhBookList object of @profile. The returned object is guaranteed to 155 | * be the same for the lifetime of @profile. 156 | * 157 | * Returns: (transfer none): the #DhBookList of @profile. 158 | * Since: 3.30 159 | */ 160 | DhBookList * 161 | dh_profile_get_book_list (DhProfile *profile) 162 | { 163 | g_return_val_if_fail (DH_IS_PROFILE (profile), NULL); 164 | 165 | return profile->priv->book_list; 166 | } 167 | -------------------------------------------------------------------------------- /devhelp/dh-profile.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_PROFILE_H 7 | #define DH_PROFILE_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | #define DH_TYPE_PROFILE (dh_profile_get_type ()) 16 | #define DH_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_PROFILE, DhProfile)) 17 | #define DH_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_PROFILE, DhProfileClass)) 18 | #define DH_IS_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_PROFILE)) 19 | #define DH_IS_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_PROFILE)) 20 | #define DH_PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_PROFILE, DhProfileClass)) 21 | 22 | typedef struct _DhProfile DhProfile; 23 | typedef struct _DhProfileClass DhProfileClass; 24 | typedef struct _DhProfilePrivate DhProfilePrivate; 25 | 26 | struct _DhProfile { 27 | GObject parent; 28 | 29 | DhProfilePrivate *priv; 30 | }; 31 | 32 | struct _DhProfileClass { 33 | GObjectClass parent_class; 34 | 35 | /* Padding for future expansion */ 36 | gpointer padding[12]; 37 | }; 38 | 39 | GType dh_profile_get_type (void); 40 | 41 | G_GNUC_INTERNAL 42 | DhProfile * _dh_profile_new (DhSettings *settings, 43 | DhBookList *book_list); 44 | 45 | DhProfile * dh_profile_get_default (void); 46 | 47 | G_GNUC_INTERNAL 48 | void _dh_profile_unref_default (void); 49 | 50 | DhSettings * dh_profile_get_settings (DhProfile *profile); 51 | 52 | DhBookList * dh_profile_get_book_list (DhProfile *profile); 53 | 54 | G_END_DECLS 55 | 56 | #endif /* DH_PROFILE_H */ 57 | -------------------------------------------------------------------------------- /devhelp/dh-search-bar.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_SEARCH_BAR_H 7 | #define DH_SEARCH_BAR_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_SEARCH_BAR (dh_search_bar_get_type ()) 15 | #define DH_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_SEARCH_BAR, DhSearchBar)) 16 | #define DH_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_SEARCH_BAR, DhSearchBarClass)) 17 | #define DH_IS_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_SEARCH_BAR)) 18 | #define DH_IS_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_SEARCH_BAR)) 19 | #define DH_SEARCH_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_SEARCH_BAR, DhSearchBarClass)) 20 | 21 | typedef struct _DhSearchBar DhSearchBar; 22 | typedef struct _DhSearchBarClass DhSearchBarClass; 23 | typedef struct _DhSearchBarPrivate DhSearchBarPrivate; 24 | 25 | struct _DhSearchBar { 26 | GtkSearchBar parent; 27 | 28 | DhSearchBarPrivate *priv; 29 | }; 30 | 31 | struct _DhSearchBarClass { 32 | GtkSearchBarClass parent_class; 33 | 34 | /* Padding for future expansion */ 35 | gpointer padding[12]; 36 | }; 37 | 38 | GType dh_search_bar_get_type (void); 39 | 40 | DhSearchBar * dh_search_bar_new (DhNotebook *notebook); 41 | 42 | DhNotebook * dh_search_bar_get_notebook (DhSearchBar *search_bar); 43 | 44 | void dh_search_bar_grab_focus_to_search_entry (DhSearchBar *search_bar); 45 | 46 | G_END_DECLS 47 | 48 | #endif /* DH_SEARCH_BAR_H */ 49 | -------------------------------------------------------------------------------- /devhelp/dh-search-context.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_SEARCH_CONTEXT_H 7 | #define DH_SEARCH_CONTEXT_H 8 | 9 | #include 10 | #include "dh-book.h" 11 | #include "dh-link.h" 12 | 13 | G_BEGIN_DECLS 14 | 15 | typedef struct _DhSearchContext DhSearchContext; 16 | 17 | G_GNUC_INTERNAL 18 | DhSearchContext * _dh_search_context_new (const gchar *search_string); 19 | 20 | G_GNUC_INTERNAL 21 | void _dh_search_context_free (DhSearchContext *search); 22 | 23 | G_GNUC_INTERNAL 24 | const gchar * _dh_search_context_get_book_id (DhSearchContext *search); 25 | 26 | G_GNUC_INTERNAL 27 | const gchar * _dh_search_context_get_page_id (DhSearchContext *search); 28 | 29 | G_GNUC_INTERNAL 30 | GStrv _dh_search_context_get_keywords (DhSearchContext *search); 31 | 32 | G_GNUC_INTERNAL 33 | gboolean _dh_search_context_get_case_sensitive (DhSearchContext *search); 34 | 35 | G_GNUC_INTERNAL 36 | gboolean _dh_search_context_match_book (DhSearchContext *search, 37 | DhBook *book); 38 | 39 | G_GNUC_INTERNAL 40 | gboolean _dh_search_context_match_link (DhSearchContext *search, 41 | DhLink *link, 42 | gboolean prefix); 43 | 44 | G_GNUC_INTERNAL 45 | gboolean _dh_search_context_is_exact_link (DhSearchContext *search, 46 | DhLink *link); 47 | 48 | G_END_DECLS 49 | 50 | #endif /* DH_SEARCH_CONTEXT_H */ 51 | -------------------------------------------------------------------------------- /devhelp/dh-settings-builder.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_SETTINGS_BUILDER_H 7 | #define DH_SETTINGS_BUILDER_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_SETTINGS_BUILDER (dh_settings_builder_get_type ()) 15 | #define DH_SETTINGS_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_SETTINGS_BUILDER, DhSettingsBuilder)) 16 | #define DH_SETTINGS_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_SETTINGS_BUILDER, DhSettingsBuilderClass)) 17 | #define DH_IS_SETTINGS_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_SETTINGS_BUILDER)) 18 | #define DH_IS_SETTINGS_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_SETTINGS_BUILDER)) 19 | #define DH_SETTINGS_BUILDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_SETTINGS_BUILDER, DhSettingsBuilderClass)) 20 | 21 | typedef struct _DhSettingsBuilder DhSettingsBuilder; 22 | typedef struct _DhSettingsBuilderClass DhSettingsBuilderClass; 23 | typedef struct _DhSettingsBuilderPrivate DhSettingsBuilderPrivate; 24 | 25 | struct _DhSettingsBuilder { 26 | GObject parent; 27 | 28 | DhSettingsBuilderPrivate *priv; 29 | }; 30 | 31 | struct _DhSettingsBuilderClass { 32 | GObjectClass parent_class; 33 | 34 | /* Padding for future expansion */ 35 | gpointer padding[12]; 36 | }; 37 | 38 | GType dh_settings_builder_get_type (void); 39 | 40 | DhSettingsBuilder * 41 | dh_settings_builder_new (void); 42 | 43 | void dh_settings_builder_set_contents_path (DhSettingsBuilder *builder, 44 | const gchar *contents_path); 45 | 46 | void dh_settings_builder_set_fonts_path (DhSettingsBuilder *builder, 47 | const gchar *fonts_path); 48 | 49 | DhSettings * dh_settings_builder_create_object (DhSettingsBuilder *builder); 50 | 51 | G_END_DECLS 52 | 53 | #endif /* DH_SETTINGS_BUILDER_H */ 54 | -------------------------------------------------------------------------------- /devhelp/dh-settings.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2012 Thomas Bechtold 3 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #ifndef DH_SETTINGS_H 8 | #define DH_SETTINGS_H 9 | 10 | #include 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | #define DH_TYPE_SETTINGS (dh_settings_get_type ()) 16 | #define DH_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_SETTINGS, DhSettings)) 17 | #define DH_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_SETTINGS)) 18 | #define DH_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_SETTINGS, DhSettingsClass)) 19 | #define DH_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_SETTINGS)) 20 | #define DH_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_SETTINGS, DhSettingsClass)) 21 | 22 | typedef struct _DhSettings DhSettings; 23 | typedef struct _DhSettingsClass DhSettingsClass; 24 | typedef struct _DhSettingsPrivate DhSettingsPrivate; 25 | 26 | struct _DhSettings { 27 | GObject parent; 28 | DhSettingsPrivate *priv; 29 | }; 30 | 31 | struct _DhSettingsClass { 32 | GObjectClass parent; 33 | 34 | /* Signals */ 35 | void (* books_disabled_changed) (DhSettings *settings); 36 | void (* fonts_changed) (DhSettings *settings); 37 | 38 | /* Padding for future expansion */ 39 | gpointer padding[12]; 40 | }; 41 | 42 | GType dh_settings_get_type (void) G_GNUC_CONST; 43 | 44 | G_GNUC_INTERNAL 45 | DhSettings * _dh_settings_new (const gchar *contents_path, 46 | const gchar *fonts_path); 47 | 48 | DhSettings * dh_settings_get_default (void); 49 | 50 | G_GNUC_INTERNAL 51 | void _dh_settings_unref_default (void); 52 | 53 | void dh_settings_bind_all (DhSettings *settings); 54 | 55 | gboolean dh_settings_get_group_books_by_language (DhSettings *settings); 56 | 57 | void dh_settings_set_group_books_by_language (DhSettings *settings, 58 | gboolean group_books_by_language); 59 | 60 | void dh_settings_bind_group_books_by_language (DhSettings *settings); 61 | 62 | gboolean dh_settings_is_book_enabled (DhSettings *settings, 63 | DhBook *book); 64 | 65 | void dh_settings_set_book_enabled (DhSettings *settings, 66 | DhBook *book, 67 | gboolean enabled); 68 | 69 | void dh_settings_freeze_books_disabled_changed (DhSettings *settings); 70 | 71 | void dh_settings_thaw_books_disabled_changed (DhSettings *settings); 72 | 73 | void dh_settings_get_selected_fonts (DhSettings *settings, 74 | gchar **variable_font, 75 | gchar **fixed_font); 76 | 77 | gboolean dh_settings_get_use_system_fonts (DhSettings *settings); 78 | 79 | void dh_settings_set_use_system_fonts (DhSettings *settings, 80 | gboolean use_system_fonts); 81 | 82 | const gchar * dh_settings_get_variable_font (DhSettings *settings); 83 | 84 | void dh_settings_set_variable_font (DhSettings *settings, 85 | const gchar *variable_font); 86 | 87 | const gchar * dh_settings_get_fixed_font (DhSettings *settings); 88 | 89 | void dh_settings_set_fixed_font (DhSettings *settings, 90 | const gchar *fixed_font); 91 | 92 | void dh_settings_bind_fonts (DhSettings *settings); 93 | 94 | G_END_DECLS 95 | 96 | #endif /* DH_SETTINGS_H */ 97 | -------------------------------------------------------------------------------- /devhelp/dh-sidebar.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2001-2002 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2001-2002 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2013 Aleksander Morgado 5 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | */ 8 | 9 | #ifndef DH_SIDEBAR_H 10 | #define DH_SIDEBAR_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define DH_TYPE_SIDEBAR (dh_sidebar_get_type ()) 20 | #define DH_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_SIDEBAR, DhSidebar)) 21 | #define DH_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_SIDEBAR, DhSidebarClass)) 22 | #define DH_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_SIDEBAR)) 23 | #define DH_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_SIDEBAR)) 24 | 25 | typedef struct _DhSidebar DhSidebar; 26 | typedef struct _DhSidebarClass DhSidebarClass; 27 | 28 | struct _DhSidebar { 29 | GtkGrid parent_instance; 30 | }; 31 | 32 | struct _DhSidebarClass { 33 | GtkGridClass parent_class; 34 | 35 | /* Signals */ 36 | void (*link_selected) (DhSidebar *sidebar, 37 | DhLink *link); 38 | 39 | /* Padding for future expansion */ 40 | gpointer padding[12]; 41 | }; 42 | 43 | GType dh_sidebar_get_type (void); 44 | 45 | G_DEPRECATED_FOR (dh_sidebar_new2) 46 | GtkWidget * dh_sidebar_new (DhBookManager *book_manager); 47 | 48 | DhSidebar * dh_sidebar_new2 (DhProfile *profile); 49 | 50 | DhProfile * dh_sidebar_get_profile (DhSidebar *sidebar); 51 | 52 | DhLink * dh_sidebar_get_selected_link (DhSidebar *sidebar); 53 | 54 | void dh_sidebar_select_uri (DhSidebar *sidebar, 55 | const gchar *uri); 56 | 57 | void dh_sidebar_set_search_string (DhSidebar *sidebar, 58 | const gchar *str); 59 | 60 | void dh_sidebar_set_search_focus (DhSidebar *sidebar); 61 | 62 | G_END_DECLS 63 | 64 | #endif /* DH_SIDEBAR_H */ 65 | -------------------------------------------------------------------------------- /devhelp/dh-tab-label.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_TAB_LABEL_H 7 | #define DH_TAB_LABEL_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_TAB_LABEL (dh_tab_label_get_type ()) 15 | #define DH_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_TAB_LABEL, DhTabLabel)) 16 | #define DH_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_TAB_LABEL, DhTabLabelClass)) 17 | #define DH_IS_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_TAB_LABEL)) 18 | #define DH_IS_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_TAB_LABEL)) 19 | #define DH_TAB_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_TAB_LABEL, DhTabLabelClass)) 20 | 21 | typedef struct _DhTabLabel DhTabLabel; 22 | typedef struct _DhTabLabelClass DhTabLabelClass; 23 | typedef struct _DhTabLabelPrivate DhTabLabelPrivate; 24 | 25 | struct _DhTabLabel { 26 | GtkGrid parent; 27 | 28 | DhTabLabelPrivate *priv; 29 | }; 30 | 31 | struct _DhTabLabelClass { 32 | GtkGridClass parent_class; 33 | 34 | /* Padding for future expansion */ 35 | gpointer padding[12]; 36 | }; 37 | 38 | GType dh_tab_label_get_type (void); 39 | 40 | GtkWidget * dh_tab_label_new (DhTab *tab); 41 | 42 | DhTab * dh_tab_label_get_tab (DhTabLabel *tab_label); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* DH_TAB_LABEL_H */ 47 | -------------------------------------------------------------------------------- /devhelp/dh-tab.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_TAB_H 7 | #define DH_TAB_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_TAB (dh_tab_get_type ()) 15 | #define DH_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_TAB, DhTab)) 16 | #define DH_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_TAB, DhTabClass)) 17 | #define DH_IS_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_TAB)) 18 | #define DH_IS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_TAB)) 19 | #define DH_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_TAB, DhTabClass)) 20 | 21 | typedef struct _DhTab DhTab; 22 | typedef struct _DhTabClass DhTabClass; 23 | typedef struct _DhTabPrivate DhTabPrivate; 24 | 25 | struct _DhTab { 26 | GtkGrid parent; 27 | 28 | DhTabPrivate *priv; 29 | }; 30 | 31 | struct _DhTabClass { 32 | GtkGridClass parent_class; 33 | 34 | /* Padding for future expansion */ 35 | gpointer padding[12]; 36 | }; 37 | 38 | GType dh_tab_get_type (void); 39 | 40 | DhTab * dh_tab_new (DhWebView *web_view); 41 | 42 | DhWebView * dh_tab_get_web_view (DhTab *tab); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* DH_TAB_H */ 47 | -------------------------------------------------------------------------------- /devhelp/dh-util-lib.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2001-2002 Mikael Hallendal 3 | * SPDX-FileCopyrightText: 2004,2008 Imendio AB 4 | * SPDX-FileCopyrightText: 2015, 2017, 2018 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #ifndef DH_UTIL_LIB_H 9 | #define DH_UTIL_LIB_H 10 | 11 | #include 12 | #include "dh-notebook.h" 13 | #include "dh-sidebar.h" 14 | 15 | G_BEGIN_DECLS 16 | 17 | G_GNUC_INTERNAL 18 | gchar * _dh_util_build_data_filename (const gchar *first_part, 19 | ...); 20 | 21 | G_GNUC_INTERNAL 22 | void _dh_util_ascii_strtitle (gchar *str); 23 | 24 | G_GNUC_INTERNAL 25 | gchar * _dh_util_create_data_uri_for_filename (const gchar *filename, 26 | const gchar *mime_type); 27 | 28 | G_GNUC_INTERNAL 29 | void _dh_util_queue_concat (GQueue *q1, 30 | GQueue *q2); 31 | 32 | G_GNUC_INTERNAL 33 | void _dh_util_free_book_tree (GNode *book_tree); 34 | 35 | G_GNUC_INTERNAL 36 | GSList * _dh_util_get_possible_index_files (GFile *book_directory); 37 | 38 | G_GNUC_INTERNAL 39 | void _dh_util_bind_sidebar_and_notebook (DhSidebar *sidebar, 40 | DhNotebook *notebook); 41 | 42 | G_END_DECLS 43 | 44 | #endif /* DH_UTIL_LIB_H */ 45 | -------------------------------------------------------------------------------- /devhelp/dh-web-view.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_WEB_VIEW_H 7 | #define DH_WEB_VIEW_H 8 | 9 | #include 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_WEB_VIEW (dh_web_view_get_type ()) 15 | #define DH_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_WEB_VIEW, DhWebView)) 16 | #define DH_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_WEB_VIEW, DhWebViewClass)) 17 | #define DH_IS_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_WEB_VIEW)) 18 | #define DH_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_WEB_VIEW)) 19 | #define DH_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_WEB_VIEW, DhWebViewClass)) 20 | 21 | typedef struct _DhWebView DhWebView; 22 | typedef struct _DhWebViewClass DhWebViewClass; 23 | typedef struct _DhWebViewPrivate DhWebViewPrivate; 24 | 25 | struct _DhWebView { 26 | WebKitWebView parent; 27 | 28 | DhWebViewPrivate *priv; 29 | }; 30 | 31 | struct _DhWebViewClass { 32 | WebKitWebViewClass parent_class; 33 | 34 | /* Signals */ 35 | void (* open_new_tab) (DhWebView *view, 36 | const gchar *uri); 37 | 38 | /* Padding for future expansion */ 39 | gpointer padding[12]; 40 | }; 41 | 42 | GType dh_web_view_get_type (void); 43 | 44 | DhWebView * dh_web_view_new (DhProfile *profile); 45 | 46 | DhProfile * dh_web_view_get_profile (DhWebView *view); 47 | 48 | const gchar * dh_web_view_get_devhelp_title (DhWebView *view); 49 | 50 | void dh_web_view_set_search_text (DhWebView *view, 51 | const gchar *search_text); 52 | 53 | void dh_web_view_search_next (DhWebView *view); 54 | 55 | void dh_web_view_search_previous (DhWebView *view); 56 | 57 | gboolean dh_web_view_can_zoom_in (DhWebView *view); 58 | 59 | gboolean dh_web_view_can_zoom_out (DhWebView *view); 60 | 61 | gboolean dh_web_view_can_reset_zoom (DhWebView *view); 62 | 63 | void dh_web_view_zoom_in (DhWebView *view); 64 | 65 | void dh_web_view_zoom_out (DhWebView *view); 66 | 67 | void dh_web_view_reset_zoom (DhWebView *view); 68 | 69 | G_END_DECLS 70 | 71 | #endif /* DH_WEB_VIEW_H */ 72 | -------------------------------------------------------------------------------- /devhelp/future/README: -------------------------------------------------------------------------------- 1 | For the future. The code in this directory is not compiled (but has been tested 2 | when written of course). Instead of the code bit-rotting in a forgotten branch, 3 | have the code on git master to ensure to have a backup. And elsewhere in the 4 | git repo, be able to make references to the experiments done here. 5 | -------------------------------------------------------------------------------- /devhelp/future/dh-dconf-migration.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018, 2019 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #include "dh-dconf-migration.h" 7 | #include 8 | 9 | /* #DhDconfMigration is a utility class to copy the value of dconf keys from old 10 | * paths to new paths. 11 | * 12 | * You'll probably need to add a "migration-done" #GSettings key to know if the 13 | * migration has already been done or not (either with a boolean, or an integer 14 | * if you plan to have other migrations in the future). 15 | * 16 | * Use-case examples: 17 | * - When a project is renamed. The old #GSettings schema may no longer be 18 | * installed, so it is not possible to use the #GSettings API to retrieve the 19 | * values at the old locations. But the values are still stored in the dconf 20 | * database. 21 | * - Be able to do refactorings in the #GSettings schema without users losing 22 | * their settings when *upgrading* to a new version (doesn't work when 23 | * downgrading). 24 | * - When a library uses #GSettings, with parallel-installability for different 25 | * major versions, each major version provides a different #GSettings schema, 26 | * but when upgrading to a new major version we don't want all the users to 27 | * lose their settings. An alternative is for the library to install only 28 | * relocatable schemas, relocated to an old common path (if all the keys of 29 | * that schema are still compatible). When a schema (or sub-schema) becomes 30 | * incompatible, the compatible keys can be migrated individually with 31 | * #DhDconfMigration. 32 | */ 33 | 34 | /* Tested inside a Flatpak sandbox, works fine. */ 35 | 36 | struct _DhDconfMigration { 37 | DConfClient *client; 38 | }; 39 | 40 | DhDconfMigration * 41 | _dh_dconf_migration_new (void) 42 | { 43 | DhDconfMigration *migration; 44 | 45 | migration = g_new0 (DhDconfMigration, 1); 46 | migration->client = dconf_client_new (); 47 | 48 | return migration; 49 | } 50 | 51 | /* 52 | * _dh_dconf_migration_migrate_key: 53 | * @migration: a #DhDconfMigration. 54 | * @new_key_path: the dconf path to the new key. 55 | * @first_old_key_path: the dconf path to the first old key. 56 | * @...: %NULL-terminated list of strings containing the dconf paths to the old 57 | * keys (usually from most recent to the oldest). 58 | * 59 | * Copies a value from an old path to a new path. The values on the old paths 60 | * are not reset, it is just a copy. 61 | * 62 | * The function loops on the old key paths, in the same order as provided; as 63 | * soon as an old key contains a value, that value is copied to @new_key_path 64 | * and the function returns. Which means that, usually, all the keys must be 65 | * provided in reverse chronological order. 66 | */ 67 | void 68 | _dh_dconf_migration_migrate_key (DhDconfMigration *migration, 69 | const gchar *new_key_path, 70 | const gchar *first_old_key_path, 71 | ...) 72 | { 73 | va_list old_key_paths; 74 | GVariant *value; 75 | 76 | g_return_if_fail (migration != NULL); 77 | g_return_if_fail (new_key_path != NULL); 78 | g_return_if_fail (first_old_key_path != NULL); 79 | 80 | va_start (old_key_paths, first_old_key_path); 81 | 82 | value = dconf_client_read (migration->client, first_old_key_path); 83 | 84 | while (value == NULL) { 85 | const gchar *next_old_key_path; 86 | 87 | next_old_key_path = va_arg (old_key_paths, const gchar *); 88 | if (next_old_key_path == NULL) 89 | break; 90 | 91 | value = dconf_client_read (migration->client, next_old_key_path); 92 | } 93 | 94 | if (value != NULL) { 95 | GError *error = NULL; 96 | 97 | /* The GVariant type is not checked against the new GSettings 98 | * schema. If we write a value with an incompatible type by 99 | * mistake, no problem, GSettings will take the default value 100 | * from the schema (without printing a warning). 101 | */ 102 | dconf_client_write_fast (migration->client, new_key_path, value, &error); 103 | 104 | if (error != NULL) { 105 | g_warning ("Error when migrating dconf key %s: %s", 106 | new_key_path, 107 | error->message); 108 | g_clear_error (&error); 109 | } 110 | 111 | g_variant_unref (value); 112 | } 113 | 114 | va_end (old_key_paths); 115 | } 116 | 117 | void 118 | _dh_dconf_migration_sync_and_free (DhDconfMigration *migration) 119 | { 120 | if (migration == NULL) 121 | return; 122 | 123 | dconf_client_sync (migration->client); 124 | 125 | g_object_unref (migration->client); 126 | g_free (migration); 127 | } 128 | -------------------------------------------------------------------------------- /devhelp/future/dh-dconf-migration.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2018, 2019 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_DCONF_MIGRATION_H 7 | #define DH_DCONF_MIGRATION_H 8 | 9 | #include 10 | 11 | G_BEGIN_DECLS 12 | 13 | typedef struct _DhDconfMigration DhDconfMigration; 14 | 15 | G_GNUC_INTERNAL 16 | DhDconfMigration * _dh_dconf_migration_new (void); 17 | 18 | G_GNUC_INTERNAL 19 | void _dh_dconf_migration_migrate_key (DhDconfMigration *migration, 20 | const gchar *new_key_path, 21 | const gchar *first_old_key_path, 22 | ...); 23 | 24 | G_GNUC_INTERNAL 25 | void _dh_dconf_migration_sync_and_free (DhDconfMigration *migration); 26 | 27 | G_END_DECLS 28 | 29 | #endif /* DH_DCONF_MIGRATION_H */ 30 | -------------------------------------------------------------------------------- /devhelp/meson.build: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2018 Sébastien Wilmet 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | libdevhelp_public_headers = [ 5 | 'devhelp.h', 6 | 'dh-application-window.h', 7 | 'dh-assistant-view.h', 8 | 'dh-book.h', 9 | 'dh-book-list.h', 10 | 'dh-book-list-builder.h', 11 | 'dh-book-list-directory.h', 12 | 'dh-book-manager.h', 13 | 'dh-book-tree.h', 14 | 'dh-completion.h', 15 | 'dh-init.h', 16 | 'dh-keyword-model.h', 17 | 'dh-link.h', 18 | 'dh-notebook.h', 19 | 'dh-profile.h', 20 | 'dh-profile-builder.h', 21 | 'dh-search-bar.h', 22 | 'dh-settings.h', 23 | 'dh-settings-builder.h', 24 | 'dh-sidebar.h', 25 | 'dh-tab.h', 26 | 'dh-tab-label.h', 27 | 'dh-web-view.h' 28 | ] 29 | 30 | libdevhelp_public_c_files = [ 31 | 'dh-application-window.c', 32 | 'dh-assistant-view.c', 33 | 'dh-book.c', 34 | 'dh-book-list.c', 35 | 'dh-book-list-builder.c', 36 | 'dh-book-list-directory.c', 37 | 'dh-book-manager.c', 38 | 'dh-book-tree.c', 39 | 'dh-completion.c', 40 | 'dh-init.c', 41 | 'dh-keyword-model.c', 42 | 'dh-link.c', 43 | 'dh-notebook.c', 44 | 'dh-profile.c', 45 | 'dh-profile-builder.c', 46 | 'dh-search-bar.c', 47 | 'dh-settings.c', 48 | 'dh-settings-builder.c', 49 | 'dh-sidebar.c', 50 | 'dh-tab.c', 51 | 'dh-tab-label.c', 52 | 'dh-web-view.c' 53 | ] 54 | 55 | libdevhelp_private_c_files = [ 56 | 'dh-book-list-simple.c', 57 | 'dh-error.c', 58 | 'dh-parser.c', 59 | 'dh-search-context.c', 60 | 'dh-util-lib.c' 61 | ] 62 | 63 | headers_install_dir = get_option('includedir') / 'devhelp-@0@/devhelp/'.format(LIBDEVHELP_API_VERSION) 64 | install_headers( 65 | libdevhelp_public_headers, 66 | install_dir: headers_install_dir 67 | ) 68 | 69 | libdevhelp_enum_types = GNOME.mkenums_simple( 70 | 'dh-enum-types', 71 | sources: libdevhelp_public_headers, 72 | install_header: true, 73 | install_dir: headers_install_dir 74 | ) 75 | 76 | libdevhelp_static_lib = static_library( 77 | 'devhelp-static', 78 | [libdevhelp_public_c_files, 79 | libdevhelp_private_c_files, 80 | libdevhelp_enum_types], 81 | pic: true, # libdevhelp_static_lib is linked in a shared library. 82 | include_directories: ROOT_INCLUDE_DIR, 83 | dependencies: LIBDEVHELP_DEPS 84 | ) 85 | 86 | # For unit tests, to be able to test private functions. 87 | LIBDEVHELP_STATIC_DEP = declare_dependency( 88 | include_directories: ROOT_INCLUDE_DIR, 89 | link_with: libdevhelp_static_lib, 90 | sources: libdevhelp_enum_types[1], 91 | dependencies: LIBDEVHELP_DEPS 92 | ) 93 | 94 | symbol_map = meson.current_source_dir() / 'symbol.map' 95 | 96 | libdevhelp_shared_lib = shared_library( 97 | 'devhelp-@0@'.format(LIBDEVHELP_API_VERSION), 98 | link_whole: libdevhelp_static_lib, 99 | link_args: '-Wl,--version-script,' + symbol_map, 100 | link_depends: symbol_map, 101 | version: LIBDEVHELP_LT_VERSION, 102 | install: true 103 | ) 104 | 105 | LIBDEVHELP_SHARED_LIB_DEP = declare_dependency( 106 | include_directories: ROOT_INCLUDE_DIR, 107 | link_with: libdevhelp_shared_lib, 108 | sources: libdevhelp_enum_types[1], 109 | dependencies: LIBDEVHELP_DEPS 110 | ) 111 | 112 | PKG_CONFIG.generate( 113 | filebase: 'libdevhelp-@0@'.format(LIBDEVHELP_API_VERSION_FULL), 114 | name: meson.project_name(), 115 | description: meson.project_name(), 116 | libraries: libdevhelp_shared_lib, 117 | libraries_private: '-lm', 118 | subdirs: 'devhelp-@0@'.format(LIBDEVHELP_API_VERSION), 119 | requires: LIBDEVHELP_PUBLIC_DEPS, 120 | requires_private: LIBDEVHELP_PRIVATE_DEPS 121 | ) 122 | 123 | libdevhelp_gir = GNOME.generate_gir( 124 | libdevhelp_shared_lib, 125 | export_packages: 'libdevhelp-@0@'.format(LIBDEVHELP_API_VERSION_FULL), 126 | header: 'devhelp/devhelp.h', 127 | identifier_prefix: 'Dh', 128 | include_directories: ROOT_INCLUDE_DIR, 129 | includes: ['Gtk-3.0', 'WebKit2-' + webkit_abi], 130 | install: true, 131 | namespace: 'Devhelp', 132 | nsversion: LIBDEVHELP_API_VERSION_FULL, 133 | sources: [ 134 | libdevhelp_public_headers, 135 | libdevhelp_public_c_files, 136 | libdevhelp_enum_types 137 | ], 138 | extra_args: [ 139 | '--warn-all', 140 | '--quiet', 141 | ], 142 | ) 143 | -------------------------------------------------------------------------------- /devhelp/symbol.map: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | dh_*; 4 | local: 5 | *; 6 | }; 7 | -------------------------------------------------------------------------------- /docs/reference/devhelp.toml.in: -------------------------------------------------------------------------------- 1 | [library] 2 | version = "@version@" 3 | browse_url = "https://gitlab.gnome.org/GNOME/devhelp/" 4 | repository_url = "https://gitlab.gnome.org/GNOME/devhelp.git" 5 | website_url = "https://wiki.gnome.org/Apps/Devhelp" 6 | authors = "The Devhelp Authors" 7 | license = "GPL-3.0-or-later" 8 | logo_url = "devhelp.svg" 9 | description = "A library for discovering, browsing, and searching developer documentation for the GNOME project" 10 | devhelp = true 11 | search_index = true 12 | dependencies = ["Gtk-3.0",] 13 | 14 | [dependencies."Gtk-3.0"] 15 | name = "GTK 3" 16 | description = "The GTK toolkit" 17 | docs_url = "https://developer.gnome.org/gtk3/stable/" 18 | 19 | [dependencies."WebKit2-4.0"] 20 | name = "WebKitGTK 2" 21 | description = "WebKit rendering widget for GTK" 22 | docs_url = "https://webkitgtk.org/reference/webkit2gtk/stable/" 23 | 24 | [theme] 25 | name = "basic" 26 | show_index_summary = true 27 | show_class_hierarchy = true 28 | 29 | [source-location] 30 | base_url = "https://gitlab.gnome.org/GNOME/devhelp/-/blob/HEAD/devhelp/" 31 | 32 | [extra] 33 | content_files = [ 34 | "api-breaks.md", 35 | ] 36 | content_images = [ 37 | "devhelp.svg", 38 | ] 39 | -------------------------------------------------------------------------------- /docs/reference/meson.build: -------------------------------------------------------------------------------- 1 | docs_dir = get_option('prefix') / get_option('datadir') / 'doc' 2 | 3 | extra_content_files = [ 4 | 'api-breaks.md', 5 | ] 6 | 7 | dependency('gi-docgen', version: '>= 2021.6', 8 | fallback: ['gi-docgen', 'dummy_dep'], 9 | required: get_option('gtk_doc'), 10 | ) 11 | 12 | gidocgen = find_program('gi-docgen', required: get_option('gtk_doc')) 13 | 14 | if get_option('gtk_doc') 15 | toml_data = configuration_data() 16 | toml_data.set('version', meson.project_version()) 17 | 18 | devhelp_toml = configure_file( 19 | input: 'devhelp.toml.in', 20 | output: 'devhelp-@0@.toml'.format(LIBDEVHELP_API_VERSION), 21 | configuration: toml_data, 22 | install: true, 23 | install_dir: docs_dir / 'devhelp-@0@'.format(LIBDEVHELP_API_VERSION), 24 | ) 25 | 26 | custom_target('devhelp-doc', 27 | input: [devhelp_toml, libdevhelp_gir], 28 | output: 'devhelp-@0@'.format(LIBDEVHELP_API_VERSION), 29 | command: [ 30 | gidocgen, 31 | 'generate', 32 | '--quiet', 33 | '--fatal-warnings', 34 | '--add-include-path=@0@'.format(meson.current_build_dir() / '../../devhelp'), 35 | '--config=@INPUT0@', 36 | '--output-dir=@OUTPUT@', 37 | '--no-namespace-dir', 38 | '--content-dir=@0@'.format(meson.current_source_dir()), 39 | '@INPUT1@', 40 | ], 41 | depend_files: extra_content_files, 42 | build_by_default: true, 43 | install: true, 44 | install_dir: docs_dir, 45 | ) 46 | endif 47 | -------------------------------------------------------------------------------- /docs/similar-apps.md: -------------------------------------------------------------------------------- 1 | Similar apps to Devhelp 2 | ======================= 3 | 4 | Can serve as inspiration to develop Devhelp. 5 | 6 | - [Dash](https://kapeli.com/dash) (macOS) 7 | - [Zeal](https://zealdocs.org/) 8 | - [ZevDocs](https://github.com/jkozera/zevdocs) - a fork of Devhelp with support for zealcore 9 | -------------------------------------------------------------------------------- /help/C/book-format.page: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | Book format 15 | 16 | 17 |

18 | A “book” in Devhelp is the API documentation for one module, or 19 | package (usually a library). This page describes the format that a book 20 | needs to follow in order for Devhelp to recognize it. 21 |

22 |
23 | 24 |

25 | The content of a book is placed in one directory (that directory contains 26 | only one book, it cannot contain several books). The directory is comprised 27 | of: 28 |

29 | 30 |

31 | HTML pages, plus possibly CSS files, images, etc; 32 |

33 |

34 | An index file with the *.devhelp2 file extension, see 35 | for more information. 36 |

37 |
38 | 39 |

40 | Restriction: the name of the directory the *.devhelp2 file is 41 | in and the name of the *.devhelp2 file (minus the extension) 42 | must match. In other words, if the book directory is called 43 | $book_name, then the absolute path to the index file should 44 | end with $book_name/$book_name.devhelp2. That way, when 45 | Devhelp knows the directory name, it directly knows the location 46 | to the index file. 47 |

48 |
49 |
50 | -------------------------------------------------------------------------------- /help/C/index-file-format.page: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | Index file format 15 | 16 | 17 |

18 | This page describes the purpose and the format of *.devhelp2 19 | index files. 20 |

21 |
22 | 23 |

24 | A book (see ) contains one index file. The index 25 | file has the extension .devhelp2 and has an XML format. 26 |

27 | 28 | 29 |

30 | The “2” in the *.devhelp2 file extension is because it is the 31 | second version of the file format. The first version of the format, with 32 | the *.devhelp file extension, is deprecated and its support in 33 | Devhelp may be removed in the future. On application startup, 34 | when Devhelp scans the filesystem to find books, it emits a 35 | warning message in the terminal for each book that uses a deprecated 36 | format. 37 |

38 |
39 | 40 |

41 | The index file mainly contains: 42 |

43 | 44 |

45 | The book structure (like a table of contents). 46 |

47 |

48 | A list of symbols (functions, types, macros, signals, properties, …). 49 |

50 |
51 |

52 | These contain links to the HTML files to reach the corresponding pages and 53 | symbols. 54 |

55 |

56 | In Devhelp the book structure is shown in the side panel. And the 57 | search in the side panel shows results found in 58 | the index files. 59 |

60 | 61 |
62 | Specification of the <file>*.devhelp2</file> XML file format 63 |

64 | Unfortunately the *.devhelp2 XML file format is not well 65 | documented. There is still some hope that it will be fixed in the near 66 | future. In the meantime, we recommend to look at what 67 | GTK-Doc generates. 68 | For the most precise definition of what Devhelp supports, read 69 | the parser source code and the Devhelp API reference. 70 |

71 |
72 |
73 | -------------------------------------------------------------------------------- /help/C/index.page: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | Devhelp User Documentation 11 | Devhelp User Documentation 12 | Devhelp User Documentation 13 | 14 | Devhelp User Documentation 15 | 16 | 17 | 18 | <media type="image" width="48px" height="48px" its:translate="no" 19 | src="figures/org.gnome.Devhelp.svg" /> Devhelp User Documentation 20 | 21 | 22 | 23 |

24 | Devhelp is a developer tool for browsing and searching API documentation. 25 |

26 |
27 |
28 | -------------------------------------------------------------------------------- /help/C/installing-api-documentation.page: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | Installing API documentation 15 | 16 | 17 |

How Devhelp finds the API documentation.

18 |
19 | 20 | 21 | 22 |
23 | Book format 24 |

25 | See for information on the API documentation 26 | format that Devhelp recognizes. 27 |

28 |
29 | 30 |
31 | Books locations 32 |

33 | Once a book follows the right format, its directory needs to be installed 34 | at a location where Devhelp will find it. 35 |

36 |

37 | Devhelp uses the 38 | XDG Base Directory Specification 39 | to find the books. The list of locations searched is: 40 |

41 | 42 |

$XDG_DATA_HOME/devhelp/books/

43 |

$XDG_DATA_HOME/gtk-doc/html/

44 |

$XDG_DATA_DIRS/devhelp/books/

45 |

$XDG_DATA_DIRS/gtk-doc/html/

46 |
47 |

48 | Note that the two latter consist of lists of directories to look for. 49 | Directory values are separated by : characters. Those 50 | environment variables are normally set up by the desktop environment or 51 | distribution. 52 |

53 |

54 | Examples of locations to index files with $XDG_DATA_HOME on a 55 | typical system: 56 |

57 | 58 |

59 | ~/.local/share/devhelp/books/glib/glib.devhelp2 60 |

61 |

62 | ~/.var/app/org.gnome.Devhelp/data/devhelp/books/glib/glib.devhelp2 63 | if Devhelp is launched with 64 | Flatpak. 65 |

66 |
67 |

68 | Example of a location to an index file with $XDG_DATA_DIRS on 69 | a typical system: 70 |

71 | 72 |

73 | /usr/share/gtk-doc/html/glib/glib.devhelp2 74 |

75 |
76 |
77 | 78 |
79 | GTK-Doc 80 |

81 | GTK-Doc is a 82 | tool to generate API documentation from comments added to C code. It is 83 | used by GLib, GTK and GNOME libraries and applications. 84 |

85 |

86 | GTK-Doc installs the API reference of a module into: 87 |

88 |

89 | $datadir/gtk-doc/html/$module_name/ 90 |

91 |

92 | It follows the book format supported by Devhelp. So by using 93 | GTK-Doc, the API reference can be browsed in Devhelp 94 | automatically (once installed in the right location, that is). 95 |

96 |
97 |
98 | -------------------------------------------------------------------------------- /help/C/search.page: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | Search in the side panel 15 | 16 | 17 |

How the search in the side panel works.

18 |
19 | 20 |
21 | Case sensitivity 22 |

23 | The search is case sensitive when there is an uppercase letter. If the 24 | search terms are all in lowercase, the search is case insensitive. It's 25 | like the “smartcase” feature present in some text editors. 26 |

27 |
28 | 29 |
30 | Glob-style pattern matching 31 |

32 | A search term can be a pattern containing ‘*’ and ‘?’ wildcards. ‘*’ 33 | matches an arbitrary, possibly empty, string; and ‘?’ matches an arbitrary 34 | character. 35 |

36 |
37 | 38 |
39 | Several search terms 40 |

41 | You can search with several search terms (separated by spaces). A symbol 42 | will match only if all the search terms individually match (not 43 | necessarily in the same order of appearance). 44 |

45 |

46 | Note that it is different than searching with the ‘*’ wildcard: with the 47 | ‘*’ wildcard it forces the keywords to be in the same order. 48 |

49 |

50 | For example when searching “gtk window application”, it 51 | matches both “gtk_window_get_application()” and 52 | “GtkApplicationWindow” (among other symbols). 53 |

54 |

55 | On the other hand, searching “gtk*window*application” will 56 | match “gtk_window_get_application()” but not 57 | “GtkApplicationWindow”. 58 |

59 |
60 |
61 | -------------------------------------------------------------------------------- /help/LINGUAS: -------------------------------------------------------------------------------- 1 | ca 2 | cs 3 | da 4 | de 5 | es 6 | eu 7 | fr 8 | gl 9 | hr 10 | hu 11 | it 12 | ko 13 | pl 14 | pt_BR 15 | sv 16 | tr 17 | uk 18 | zh_CN 19 | -------------------------------------------------------------------------------- /help/hr/hr.po: -------------------------------------------------------------------------------- 1 | # Croatian translation for devhelp. 2 | # Copyright (C) 2018 devhelp's COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the devhelp package. 4 | # 5 | msgid "" 6 | msgstr "" 7 | "Project-Id-Version: devhelp master\n" 8 | "POT-Creation-Date: 2018-02-22 11:16+0000\n" 9 | "PO-Revision-Date: 2018-02-26 16:37+0100\n" 10 | "Last-Translator: gogo \n" 11 | "Language-Team: \n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "Language: hr\n" 16 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" 17 | "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 18 | "X-Generator: Poedit 2.0.6\n" 19 | 20 | #. (itstool) path: page/title 21 | #: C/index.page:4 22 | msgid "Devhelp User Documentation" 23 | msgstr "Devhelp korisnička dokumentacija" 24 | 25 | #. Put one translator per line, in the form NAME , YEAR1, YEAR2 26 | msgctxt "_" 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " gogo https://launchpad.net/~trebelnik-stefina" 31 | 32 | #. (itstool) path: page/title 33 | #: C/search.page:10 34 | msgid "Search in the side panel" 35 | msgstr "Pretraži u bočnom panelu" 36 | 37 | #. (itstool) path: synopsis/p 38 | #: C/search.page:13 39 | msgid "How the search in the side panel works." 40 | msgstr "Kako radi pretraga u bočnom panelu." 41 | 42 | #. (itstool) path: section/title 43 | #: C/search.page:17 44 | msgid "Case sensitivity" 45 | msgstr "Osjetljivost na velika i mala slova" 46 | 47 | #. (itstool) path: section/p 48 | #: C/search.page:18 49 | msgid "" 50 | "The search is case sensitive when there is an uppercase letter. If the " 51 | "search terms are all in lowercase, the search is case insensitive. It's like " 52 | "the “smartcase” feature present in some text editors." 53 | msgstr "" 54 | "Pretraga je osjetljiva na mala i velika slova kada postoje velika slova. Ako " 55 | "izraz pretrage sadrži sva mala slova, pretraga je osjetljiva na velika i " 56 | "mala slova. To je poput \"pametne\" značajke prisutne u pojedinim " 57 | "uređivačima teksta." 58 | 59 | #. (itstool) path: section/title 60 | #: C/search.page:26 61 | msgid "Glob-style pattern matching" 62 | msgstr "Podudaranje uzoraka prema globalnom izgledu" 63 | 64 | #. (itstool) path: section/p 65 | #: C/search.page:27 66 | msgid "" 67 | "A search term can be a pattern containing ‘*’ and ‘?’ wildcards. ‘*’ matches " 68 | "an arbitrary, possibly empty, string; and ‘?’ matches an arbitrary character." 69 | msgstr "" 70 | "Izraz pretrage može biti uzorak koji sadrži ‘*’ i ‘?’ zamjenske znakove. ‘*’ " 71 | "odgovara proizvoljnom, moguće praznom izrazu; a '?' odgovara proizvoljnom " 72 | "znaku." 73 | 74 | #. (itstool) path: section/title 75 | #: C/search.page:35 76 | msgid "Several search terms" 77 | msgstr "Nekoliko izraza pretrage" 78 | 79 | #. (itstool) path: section/p 80 | #: C/search.page:36 81 | msgid "" 82 | "You can search with several search terms (separated by spaces). A symbol " 83 | "will match only if all the search terms individually match (not " 84 | "necessarily in the same order of appearance)." 85 | msgstr "" 86 | "Možete pretraživati s nekoliko izraza pretrage (odvojenim zarezom). Simbol " 87 | "će se samo podudarati ako se svi izrazi pretrage pojedinačno " 88 | "podudaraju (ne nužno u istom redoslijedu pojavljivanja)." 89 | 90 | #. (itstool) path: section/p 91 | #: C/search.page:41 92 | msgid "" 93 | "Note that it is different than searching with the ‘*’ wildcard: with the ‘*’ " 94 | "wildcard it forces the keywords to be in the same order." 95 | msgstr "" 96 | "Zapamtite da je drugačije od pretraživanja sa ‘*’ zamjenskim znakom: ‘*’ " 97 | "zamjenski znak prisiljuje ključnu riječ da bude u istom redoslijedu." 98 | 99 | #. (itstool) path: section/p 100 | #: C/search.page:45 101 | msgid "" 102 | "For example when searching “gtk window application”, it " 103 | "matches both “gtk_window_get_application()” and " 104 | "“GtkApplicationWindow” (among other symbols)." 105 | msgstr "" 106 | "Na primjer pri pretraživanju “gtk window application”, " 107 | "podudara se oboje “gtk_window_get_application()” i " 108 | "“GtkApplicationWindow” (među ostalim simbolima)." 109 | 110 | #. (itstool) path: section/p 111 | #: C/search.page:50 112 | msgid "" 113 | "On the other hand, searching “gtk*window*application” will " 114 | "match “gtk_window_get_application()” but not " 115 | "“GtkApplicationWindow”." 116 | msgstr "" 117 | "U drugu ruku, pretraživanje “gtk*window*application” će se " 118 | "podudarati sa “gtk_window_get_application()” ali ne i sa " 119 | "“GtkApplicationWindow”." 120 | -------------------------------------------------------------------------------- /help/it/it.po: -------------------------------------------------------------------------------- 1 | # Italian translation for devhelp. 2 | # Copyright (C) 2018 Free Software Foundation, Inc. 3 | # This file is distributed under the same license as the devhelp package. 4 | # Milo Casagrande , 2018. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: devhelp gnome-3-28\n" 9 | "POT-Creation-Date: 2018-03-26 11:45+0000\n" 10 | "PO-Revision-Date: 2018-03-26 14:13+0200\n" 11 | "Last-Translator: Milo Casagrande \n" 12 | "Language-Team: Italian \n" 13 | "Language: it\n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=UTF-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | "X-Generator: Poedit 2.0.6\n" 19 | 20 | #. (itstool) path: page/title 21 | #: C/index.page:4 22 | msgid "Devhelp User Documentation" 23 | msgstr "Documentazione utente di Devhelp" 24 | 25 | #. Put one translator per line, in the form NAME , YEAR1, YEAR2 26 | msgctxt "_" 27 | msgid "translator-credits" 28 | msgstr "Milo Casagrande , 2018" 29 | 30 | #. (itstool) path: page/title 31 | #: C/search.page:10 32 | msgid "Search in the side panel" 33 | msgstr "Ricerca attraverso il riquadro laterale" 34 | 35 | #. (itstool) path: synopsis/p 36 | #: C/search.page:13 37 | msgid "How the search in the side panel works." 38 | msgstr "Come funziona la ricerca nel riquadro laterale." 39 | 40 | #. (itstool) path: section/title 41 | #: C/search.page:17 42 | msgid "Case sensitivity" 43 | msgstr "Maiuscole/minuscole" 44 | 45 | #. (itstool) path: section/p 46 | #: C/search.page:18 47 | msgid "" 48 | "The search is case sensitive when there is an uppercase letter. If the " 49 | "search terms are all in lowercase, the search is case insensitive. It's like " 50 | "the “smartcase” feature present in some text editors." 51 | msgstr "" 52 | "La ricerca differenzia tra maiuscole e minuscole quando è presente almeno un " 53 | "carattere maiuscolo. Se i termini di ricerca contengono solo lettere " 54 | "minuscole, la ricerca non differenzia tra maiuscole e minuscole. Ricorda in " 55 | "parte la funzionalità di alcuni editor di testo." 56 | 57 | #. (itstool) path: section/title 58 | #: C/search.page:26 59 | msgid "Glob-style pattern matching" 60 | msgstr "Corrispondenza tramite ricerca «glob»" 61 | 62 | #. (itstool) path: section/p 63 | #: C/search.page:27 64 | msgid "" 65 | "A search term can be a pattern containing ‘*’ and ‘?’ wildcards. ‘*’ matches " 66 | "an arbitrary, possibly empty, string; and ‘?’ matches an arbitrary character." 67 | msgstr "" 68 | "Un termine di ricerca può anche essere un modello di espressione contenente " 69 | "i caratteri speciali «*» e «?». «*» corrisponde a una qualsiasi stringa, " 70 | "anche vuota; «?» corrisponde a un singolo carattere." 71 | 72 | #. (itstool) path: section/title 73 | #: C/search.page:35 74 | msgid "Several search terms" 75 | msgstr "Molteplici termini di ricerca" 76 | 77 | #. (itstool) path: section/p 78 | #: C/search.page:36 79 | msgid "" 80 | "You can search with several search terms (separated by spaces). A symbol " 81 | "will match only if all the search terms individually match (not " 82 | "necessarily in the same order of appearance)." 83 | msgstr "" 84 | "È possibile eseguire una ricerca utilizzando molteplici termini di ricerca, " 85 | "separati da spazi. Un simbolo corrisponde solo se tutti i termini " 86 | "di ricerca hanno una corrispondenza (non necessariamente nello stesso " 87 | "ordine)." 88 | 89 | #. (itstool) path: section/p 90 | #: C/search.page:41 91 | msgid "" 92 | "Note that it is different than searching with the ‘*’ wildcard: with the ‘*’ " 93 | "wildcard it forces the keywords to be in the same order." 94 | msgstr "" 95 | "Notare che la ricerca tramite il carattere «*» non ha lo stesso " 96 | "comportamento: la ricerca col carattere speciale «*» richiede che le parole " 97 | "chiavi siano nello stesso ordine." 98 | 99 | #. (itstool) path: section/p 100 | #: C/search.page:45 101 | msgid "" 102 | "For example when searching “gtk window application”, it " 103 | "matches both “gtk_window_get_application()” and " 104 | "“GtkApplicationWindow” (among other symbols)." 105 | msgstr "" 106 | "Per esempio, cercando «gtk window application», vengono " 107 | "prodotti i seguenti risultati: «gtk_window_get_application()» e " 108 | "«GtkApplicationWindow» (assieme ad altri simboli)." 109 | 110 | #. (itstool) path: section/p 111 | #: C/search.page:50 112 | msgid "" 113 | "On the other hand, searching “gtk*window*application” will " 114 | "match “gtk_window_get_application()” but not " 115 | "“GtkApplicationWindow”." 116 | msgstr "" 117 | "Utilizzando invece come modello di ricerca «gtk*window*application» viene prodotto l'unico risultato di " 119 | "«gtk_window_get_application()» e non " 120 | "«GtkApplicationWindow»." 121 | -------------------------------------------------------------------------------- /help/meson.build: -------------------------------------------------------------------------------- 1 | pages = [ 2 | 'book-format.page', 3 | 'index-file-format.page', 4 | 'index.page', 5 | 'installing-api-documentation.page', 6 | 'search.page' 7 | ] 8 | 9 | figures = [ 10 | 'figures/org.gnome.Devhelp.svg' 11 | ] 12 | 13 | GNOME.yelp( 14 | 'devhelp', 15 | sources: pages, 16 | media: figures 17 | ) 18 | -------------------------------------------------------------------------------- /help/zh_CN/zh_CN.po: -------------------------------------------------------------------------------- 1 | # Chinese (China) translation for devhelp. 2 | # Copyright (C) 2019 devhelp's COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the devhelp package. 4 | # 王滋涵 Zephyr Waitzman , 2019. 5 | # Dingzhong Chen , 2019. 6 | # 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: devhelp master\n" 10 | "POT-Creation-Date: 2019-04-08 19:06+0000\n" 11 | "PO-Revision-Date: 2019-05-04 01:26+0800\n" 12 | "Last-Translator: Dingzhong Chen \n" 13 | "Language-Team: Chinese (China) \n" 14 | "Language: zh_CN\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "X-Generator: Gtranslator 2.91.7\n" 19 | "Plural-Forms: nplurals=1; plural=0;\n" 20 | 21 | #. (itstool) path: page/title 22 | #: C/index.page:4 23 | msgid "Devhelp User Documentation" 24 | msgstr "Devhelp 用户文档" 25 | 26 | #. Put one translator per line, in the form NAME , YEAR1, YEAR2 27 | msgctxt "_" 28 | msgid "translator-credits" 29 | msgstr "王滋涵 Zephyr Waitzman , 2019" 30 | 31 | #. (itstool) path: page/title 32 | #: C/search.page:10 33 | msgid "Search in the side panel" 34 | msgstr "在侧面板中搜索" 35 | 36 | #. (itstool) path: synopsis/p 37 | #: C/search.page:13 38 | msgid "How the search in the side panel works." 39 | msgstr "侧面板中的搜索如何工作。" 40 | 41 | #. (itstool) path: section/title 42 | #: C/search.page:17 43 | msgid "Case sensitivity" 44 | msgstr "区分大小写" 45 | 46 | #. (itstool) path: section/p 47 | #: C/search.page:18 48 | msgid "" 49 | "The search is case sensitive when there is an uppercase letter. If the " 50 | "search terms are all in lowercase, the search is case insensitive. It's like " 51 | "the “smartcase” feature present in some text editors." 52 | msgstr "" 53 | "当有大写字母时,搜索区分大小写。 如果搜索条件全部为小写,则搜索不区分大小" 54 | "写。 这就像某些文本编辑器中出现的“智能区分大小写”功能。" 55 | 56 | #. (itstool) path: section/title 57 | #: C/search.page:26 58 | msgid "Glob-style pattern matching" 59 | msgstr "Glob 风格模式匹配" 60 | 61 | #. (itstool) path: section/p 62 | #: C/search.page:27 63 | msgid "" 64 | "A search term can be a pattern containing ‘*’ and ‘?’ wildcards. ‘*’ matches " 65 | "an arbitrary, possibly empty, string; and ‘?’ matches an arbitrary character." 66 | msgstr "" 67 | "搜索项可以是包含“*”和“?”通配符的模式。“*”匹配一个任意的、可能是空的字符串;与" 68 | "此同时,“?”匹配任意字符。" 69 | 70 | #. (itstool) path: section/title 71 | #: C/search.page:35 72 | msgid "Several search terms" 73 | msgstr "多个搜索词" 74 | 75 | #. (itstool) path: section/p 76 | #: C/search.page:36 77 | msgid "" 78 | "You can search with several search terms (separated by spaces). A symbol " 79 | "will match only if all the search terms individually match (not " 80 | "necessarily in the same order of appearance)." 81 | msgstr "" 82 | "您可以使用多个搜索词进行搜索(以空格分隔)。仅当所有搜索词各自匹配时" 83 | "(不一定按照相同的出现顺序),符号才会匹配。" 84 | 85 | #. (itstool) path: section/p 86 | #: C/search.page:41 87 | msgid "" 88 | "Note that it is different than searching with the ‘*’ wildcard: with the ‘*’ " 89 | "wildcard it forces the keywords to be in the same order." 90 | msgstr "" 91 | "请注意,它与使用“*”通配符搜索不同:使用“*”通配符会强制关键字处于相同的顺序。" 92 | 93 | #. (itstool) path: section/p 94 | #: C/search.page:45 95 | msgid "" 96 | "For example when searching “gtk window application”, it " 97 | "matches both “gtk_window_get_application()” and " 98 | "“GtkApplicationWindow” (among other symbols)." 99 | msgstr "" 100 | "例如,当搜索“gtk window application”时,它匹" 101 | "配“gtk_window_get_application()”和“GtkApplicationWindow”(以及其他符号)。" 103 | 104 | #. (itstool) path: section/p 105 | #: C/search.page:50 106 | msgid "" 107 | "On the other hand, searching “gtk*window*application” will " 108 | "match “gtk_window_get_application()” but not " 109 | "“GtkApplicationWindow”." 110 | msgstr "" 111 | "另一方面,搜索“gtk*window*application”将匹" 112 | "配“gtk_window_get_application()”但不匹" 113 | "配“GtkApplicationWindow”。" 114 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option( 2 | 'flatpak_build', 3 | type: 'boolean', value: false, 4 | description: 'Flatpak build mode' 5 | ) 6 | 7 | option( 8 | 'gtk_doc', 9 | type: 'boolean', value: false, 10 | description: 'Build the API reference' 11 | ) 12 | 13 | option( 14 | 'plugin_emacs', 15 | type: 'boolean', value: false, 16 | description: 'Install the Emacs plugin' 17 | ) 18 | 19 | option( 20 | 'plugin_gedit', 21 | type: 'boolean', value: false, 22 | description: 'Install the gedit plugin' 23 | ) 24 | 25 | option( 26 | 'plugin_vim', 27 | type: 'boolean', value: false, 28 | description: 'Install the Vim plugin' 29 | ) 30 | 31 | option( 32 | 'profile', 33 | type: 'combo', 34 | choices: ['stable', 'devel'], 35 | value: 'stable', 36 | description: 'The build profile', 37 | ) 38 | -------------------------------------------------------------------------------- /plugins/devhelp.el: -------------------------------------------------------------------------------- 1 | ;; Emacs integration by Richard Hult 2 | ;; 3 | 4 | (defun devhelp-word-at-point () 5 | "Searches for the current word in Devhelp" 6 | (interactive) 7 | (start-process-shell-command "devhelp" nil (concat "devhelp -s " (current-word))) 8 | (set-process-query-on-exit-flag (get-process "devhelp") nil) 9 | ) 10 | (defun devhelp-assistant-word-at-point () 11 | "Searches for the current work in the Devhelp assistant" 12 | (interactive) 13 | (setq w (current-word)) 14 | (start-process-shell-command "devhelp" nil (concat "devhelp -a " w)) 15 | (set-process-query-on-exit-flag (get-process "devhelp") nil) 16 | ) 17 | 18 | (defvar devhelp-timer nil) 19 | (defun devhelp-disable-assistant () 20 | (message "Devhelp assistant disabled") 21 | (cancel-timer devhelp-timer) 22 | (setq devhelp-timer nil) 23 | ) 24 | (defun devhelp-enable-assistant () 25 | (message "Devhelp assistant enabled") 26 | (setq devhelp-timer (run-with-idle-timer 0.6 t 'devhelp-assistant-word-at-point)) 27 | ) 28 | (defun devhelp-toggle-automatic-assistant () 29 | "Toggles automatic Devhelp assistant on and off" 30 | (interactive) 31 | (if devhelp-timer (devhelp-disable-assistant) (devhelp-enable-assistant)) 32 | ) 33 | 34 | ;; Examples: 35 | ;; 36 | ;; Bind F7 to start devhelp and search for the word at the point. 37 | ;; (global-set-key [f7] 'devhelp-word-at-point) 38 | ;; 39 | ;; Bind F6 to enable the automatic assistant. 40 | ;; (global-set-key [f6] 'devhelp-toggle-automatic-assistant) 41 | ;; 42 | ;; Bind F6 to search with the assistant window. 43 | ;; (global-set-key [f6] 'devhelp-assistant-word-at-point) 44 | 45 | (provide 'devhelp) 46 | -------------------------------------------------------------------------------- /plugins/devhelp.vim: -------------------------------------------------------------------------------- 1 | " devhelp.vim: A Devhelp assistant and search plugin for VIM. 2 | " 3 | " Copyright (c) 2008 Jannis Pohlmann 4 | " 5 | " To enable devhelp search: 6 | " let g:devhelpSearch=1 7 | " 8 | " To enable devhelp assistant: 9 | " let g:devhelpAssistant=1 10 | " 11 | " To change the update delay (e.g. to 150ms): 12 | " set updatetime=150 13 | " 14 | " To change the search key (e.g. to F5): 15 | " let g:devhelpSearchKey = '' 16 | " 17 | " To change the length (e.g. to 5 characters) before a word becomes 18 | " relevant: 19 | " let g:devhelpWordLength = 5 20 | " 21 | " This program is free software; you can redistribute it and/or modify 22 | " it under the terms of the GNU General Public License as published by 23 | " the Free Software Foundation; either version 3 of the License, or 24 | " (at your option) any later version. 25 | " 26 | " This program is distributed in the hope that it will be useful, 27 | " but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | " General Public License for more details. 30 | " 31 | " You should have received a copy of the GNU General Public License 32 | " along with this program; if not, see . 33 | 34 | " Devhelp plugin configuration. These variables may be set in .vimrc 35 | " to override the defaults 36 | if !exists ('g:devhelpSearchKey') 37 | let g:devhelpSearchKey = '' 38 | endif 39 | if !exists ('g:devhelpWordLength') 40 | let g:devhelpWordLength = 5 41 | endif 42 | 43 | " Variable for remembering the last assistant word 44 | let s:lastWord = '' 45 | 46 | function! GetCursorWord () 47 | " Try to get the word below the cursor 48 | let s:word = expand ('') 49 | 50 | " If that's empty, try to use the word before the cursor 51 | if empty (s:word) 52 | let s:before = getline ('.')[0 : getpos ('.')[2]-1] 53 | let s:start = match (s:before, '\(\w*\)$') 54 | let s:end = matchend (s:before, '\(\w*\)$') 55 | let s:word = s:before[s:start : s:end] 56 | end 57 | 58 | return s:word 59 | endfunction 60 | 61 | function! DevhelpUpdate (flag) 62 | try 63 | " Get word below or before cursor 64 | let s:word = GetCursorWord () 65 | 66 | if a:flag == 'a' 67 | " Update Devhelp assistant window 68 | if s:lastWord != s:word && strlen (s:word) > g:devhelpWordLength 69 | " Update Devhelp 70 | call system ('devhelp -a '.s:word.' &') 71 | 72 | " Remember the word for next time 73 | let s:lastWord = s:word 74 | end 75 | else 76 | " Update devhelp search window. Since the user intentionally 77 | " pressed the search key, the word is not checked for its 78 | " length or whether it's new 79 | call system ('devhelp -s '.s:word.' &') 80 | end 81 | catch 82 | endtry 83 | endfunction 84 | 85 | function! DevhelpUpdateI (flag) 86 | " Use normal update function 87 | call DevhelpUpdate (a:flag) 88 | 89 | if col ('.') == len (getline ('.')) 90 | " Start appening if the cursor at the end of the line 91 | startinsert! 92 | else 93 | " Otherwise move the cursor to the right and start inserting. 94 | " This is required because moves the cursor to the left 95 | let s:pos = getpos ('.') 96 | let s:pos[2] += 1 97 | call setpos ('.', s:pos) 98 | startinsert 99 | endif 100 | endfunction 101 | 102 | if exists ('g:devhelpSearch') && g:devhelpSearch 103 | " Update the main Devhelp window when the search key is pressed 104 | exec 'nmap '.g:devhelpSearchKey.' :call DevhelpUpdate("s")' 105 | exec 'imap '.g:devhelpSearchKey.' :call DevhelpUpdateI("s")' 106 | endif 107 | 108 | if exists ('g:devhelpAssistant') && g:devhelpAssistant 109 | " Update the assistant window if the user hasn't pressed a key for a 110 | " while. See :help updatetime for how to change this delay 111 | au! CursorHold * nested call DevhelpUpdate('a') 112 | au! CursorHoldI * nested call DevhelpUpdate('a') 113 | endif 114 | -------------------------------------------------------------------------------- /plugins/gedit-plugin/devhelp.plugin.desktop.in: -------------------------------------------------------------------------------- 1 | [Plugin] 2 | Loader=python3 3 | Module=devhelp 4 | IAge=3 5 | Name=Devhelp support 6 | Description=Makes F2 bring up Devhelp for the word at the cursor 7 | Authors=Richard Hult 8 | # Translators: Do NOT translate or transliterate this text (this is an icon file name)! 9 | Icon=org.gnome.Devhelp 10 | Copyright=Copyright © 2006 Richard Hult 11 | Website=https://wiki.gnome.org/Apps/Devhelp 12 | -------------------------------------------------------------------------------- /plugins/gedit-plugin/devhelp.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 py-indent-offset: 4 -*- 2 | # 3 | # Gedit devhelp plugin 4 | # 5 | # Copyright (C) 2006 Imendio AB 6 | # Copyright (C) 2011 Red Hat, Inc. 7 | # 8 | # Author: Richard Hult 9 | # Author: Dan Williams 10 | # 11 | # This program is free software; you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation; either version 3 of the License, or 14 | # (at your option) any later version. 15 | # 16 | # This program is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with this program; if not, see . 23 | 24 | from gi.repository import GObject, Gio, Gtk, Gedit 25 | import os 26 | import gettext 27 | 28 | class DevhelpAppActivatable(GObject.Object, Gedit.AppActivatable): 29 | 30 | app = GObject.Property(type=Gedit.App) 31 | 32 | def __init__(self): 33 | GObject.Object.__init__(self) 34 | 35 | def do_activate(self): 36 | self.app.add_accelerator("F2", "win.devhelp", None) 37 | 38 | # Translate actions below, hardcoding domain here to avoid complications now 39 | _ = lambda s: gettext.dgettext('devhelp', s) 40 | 41 | self.menu_ext = self.extend_menu("tools-section") 42 | item = Gio.MenuItem.new(_("Show API Documentation"), "win.devhelp") 43 | self.menu_ext.prepend_menu_item(item) 44 | 45 | def do_deactivate(self): 46 | self.app.remove_accelerator("win.devhelp", None) 47 | self.menu_ext = None 48 | 49 | class DevhelpWindowActivatable(GObject.Object, Gedit.WindowActivatable): 50 | 51 | window = GObject.Property(type=Gedit.Window) 52 | 53 | def __init__(self): 54 | GObject.Object.__init__(self) 55 | 56 | def do_activate(self): 57 | action = Gio.SimpleAction(name="devhelp") 58 | action.connect('activate', lambda a, p: self.do_devhelp(self.window.get_active_document())) 59 | self.window.add_action(action) 60 | 61 | def do_deactivate(self): 62 | self.window.remove_action("devhelp") 63 | 64 | def do_update_state(self): 65 | self.window.lookup_action("devhelp").set_enabled(self.window.get_active_document() is not None) 66 | 67 | def _is_word_separator(self, c): 68 | return not (c.isalnum() or c == '_') 69 | 70 | def do_devhelp(self, document): 71 | # Get the word at the cursor 72 | start = document.get_iter_at_mark(document.get_insert()) 73 | end = start.copy() 74 | 75 | # If just after a word, move back into it 76 | c = start.get_char() 77 | if self._is_word_separator(c): 78 | start.backward_char() 79 | 80 | # Go backward 81 | while True: 82 | c = start.get_char() 83 | if not self._is_word_separator(c): 84 | if not start.backward_char(): 85 | break 86 | else: 87 | start.forward_char() 88 | break 89 | 90 | # Go forward 91 | while True: 92 | c = end.get_char() 93 | if not self._is_word_separator(c): 94 | if not end.forward_char(): 95 | break 96 | else: 97 | break 98 | 99 | if end.compare(start) > 0: 100 | text = document.get_text(start,end,False).strip() 101 | if text: 102 | # FIXME: We need a dbus interface for devhelp soon... 103 | os.spawnlp(os.P_NOWAIT, 'devhelp', 'devhelp', '-s', text) 104 | 105 | # ex:ts=4:et: 106 | -------------------------------------------------------------------------------- /plugins/gedit-plugin/meson.build: -------------------------------------------------------------------------------- 1 | gedit_plugin_dir = get_option('libdir') / 'gedit/plugins' 2 | 3 | install_data( 4 | 'devhelp.py', 5 | install_dir: gedit_plugin_dir 6 | ) 7 | 8 | plugin_info_file = 'devhelp.plugin' 9 | I18N.merge_file( 10 | type: 'desktop', 11 | input: plugin_info_file + '.desktop.in', 12 | output: plugin_info_file, 13 | po_dir: '../../po/', 14 | install: true, 15 | install_dir: gedit_plugin_dir 16 | ) 17 | -------------------------------------------------------------------------------- /plugins/meson.build: -------------------------------------------------------------------------------- 1 | if get_option('plugin_gedit') 2 | subdir('gedit-plugin') 3 | endif 4 | 5 | if get_option('plugin_emacs') 6 | install_data( 7 | 'devhelp.el', 8 | install_dir: get_option('datadir') / 'emacs/site-lisp' 9 | ) 10 | endif 11 | 12 | if get_option('plugin_vim') 13 | install_data( 14 | 'devhelp.vim', 15 | install_dir: get_option('datadir') / 'vim/vimfiles/plugin' 16 | ) 17 | endif 18 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | # please keep this list sorted alphabetically 2 | # 3 | ab 4 | am 5 | ar 6 | as 7 | ast 8 | az 9 | be 10 | be@latin 11 | bg 12 | bn 13 | bn_IN 14 | bs 15 | ca 16 | ca@valencia 17 | cs 18 | da 19 | de 20 | dz 21 | el 22 | en_CA 23 | en_GB 24 | en@shaw 25 | eo 26 | es 27 | et 28 | eu 29 | fa 30 | fi 31 | fr 32 | fur 33 | gl 34 | gu 35 | he 36 | hi 37 | hr 38 | hu 39 | hy 40 | ia 41 | id 42 | is 43 | it 44 | ja 45 | ka 46 | kab 47 | kk 48 | km 49 | kn 50 | ko 51 | lt 52 | lv 53 | mai 54 | mk 55 | ml 56 | ms 57 | my 58 | nb 59 | ne 60 | nl 61 | nn 62 | oc 63 | or 64 | pa 65 | pl 66 | ps 67 | pt 68 | pt_BR 69 | ro 70 | ru 71 | rw 72 | si 73 | sk 74 | sl 75 | sq 76 | sr 77 | sr@latin 78 | sv 79 | ta 80 | te 81 | tg 82 | th 83 | tr 84 | ug 85 | uk 86 | uz 87 | vi 88 | zh_CN 89 | zh_HK 90 | zh_TW 91 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings. 2 | # Please keep this file sorted alphabetically. 3 | data/org.gnome.Devhelp.appdata.xml.in.in 4 | data/org.gnome.Devhelp.desktop.in.in 5 | data/org.gnome.devhelp.gschema.xml 6 | data/org.gnome.libdevhelp.gschema.xml.in 7 | devhelp/dh-application-window.c 8 | devhelp/dh-assistant-view.c 9 | devhelp/dh-book.c 10 | devhelp/dh-book-list-builder.c 11 | devhelp/dh-book-list.c 12 | devhelp/dh-book-list-directory.c 13 | devhelp/dh-book-list-simple.c 14 | devhelp/dh-book-manager.c 15 | devhelp/dh-book-tree.c 16 | devhelp/dh-completion.c 17 | devhelp/dh-error.c 18 | devhelp/dh-init.c 19 | devhelp/dh-keyword-model.c 20 | devhelp/dh-link.c 21 | devhelp/dh-notebook.c 22 | devhelp/dh-parser.c 23 | devhelp/dh-profile-builder.c 24 | devhelp/dh-profile.c 25 | devhelp/dh-search-bar.c 26 | devhelp/dh-search-context.c 27 | devhelp/dh-settings-builder.c 28 | devhelp/dh-settings.c 29 | devhelp/dh-sidebar.c 30 | devhelp/dh-tab.c 31 | devhelp/dh-tab-label.c 32 | devhelp/dh-util-lib.c 33 | devhelp/dh-web-view.c 34 | plugins/gedit-plugin/devhelp.plugin.desktop.in 35 | plugins/gedit-plugin/devhelp.py 36 | src/dh-app.c 37 | src/dh-assistant.c 38 | src/dh-assistant.ui 39 | src/dh-main.c 40 | src/dh-preferences.c 41 | src/dh-preferences.ui 42 | src/dh-settings-app.c 43 | src/dh-util-app.c 44 | src/dh-window.c 45 | src/dh-window.ui 46 | src/help-overlay.ui 47 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/devhelp/faeb96d9e65860252d367c4643ca94fa943a7a87/po/POTFILES.skip -------------------------------------------------------------------------------- /po/kn.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: DevHelp.Gnome-2.1\n" 9 | "POT-Creation-Date: 2004-03-16 23:25+0100\n" 10 | "PO-Revision-Date: 2002-12-17 12:12+0530\n" 11 | "Last-Translator: Pramod \n" 12 | "Language-Team: Kannada \n" 13 | "Language: kn\n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=utf-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | 18 | #: devhelp.desktop.in.h:1 19 | msgid "Developer's Help program" 20 | msgstr "" 21 | 22 | #: devhelp.desktop.in.h:2 ui/devhelp.glade.h:4 23 | msgid "Devhelp" 24 | msgstr "" 25 | 26 | #: devhelp.keys.in.h:1 27 | msgid "Devhelp Book" 28 | msgstr "" 29 | 30 | #: devhelp.schemas.in.h:1 31 | msgid "Font for fixed text" 32 | msgstr "" 33 | 34 | #: devhelp.schemas.in.h:2 35 | msgid "Font for text" 36 | msgstr "" 37 | 38 | #: devhelp.schemas.in.h:3 39 | msgid "Font for text with fixed width." 40 | msgstr "" 41 | 42 | #: devhelp.schemas.in.h:4 43 | msgid "Font for text with variable width." 44 | msgstr "" 45 | 46 | #: devhelp.schemas.in.h:5 47 | msgid "Height of main window" 48 | msgstr "" 49 | 50 | #: devhelp.schemas.in.h:6 51 | msgid "Location of the paned" 52 | msgstr "" 53 | 54 | #: devhelp.schemas.in.h:7 55 | msgid "The X position of the main window." 56 | msgstr "" 57 | 58 | #: devhelp.schemas.in.h:8 59 | msgid "The Y position of the main window." 60 | msgstr "" 61 | 62 | #: devhelp.schemas.in.h:9 63 | msgid "The height of the main window." 64 | msgstr "" 65 | 66 | #: devhelp.schemas.in.h:10 67 | msgid "The location of the paned separator." 68 | msgstr "" 69 | 70 | #: devhelp.schemas.in.h:11 71 | msgid "The width of the main window." 72 | msgstr "" 73 | 74 | #: devhelp.schemas.in.h:12 75 | msgid "Use system fonts" 76 | msgstr "" 77 | 78 | #: devhelp.schemas.in.h:13 79 | msgid "Use the system default fonts." 80 | msgstr "" 81 | 82 | #: devhelp.schemas.in.h:14 83 | msgid "Width of the main window" 84 | msgstr "" 85 | 86 | #: devhelp.schemas.in.h:15 87 | msgid "X position of main window" 88 | msgstr "" 89 | 90 | #: devhelp.schemas.in.h:16 91 | msgid "Y position of main window" 92 | msgstr "" 93 | 94 | #: src/dh-main.c:259 95 | msgid "Specify the size and location of the window" 96 | msgstr "" 97 | 98 | #: src/dh-main.c:260 99 | msgid "WIDTHxHEIGHT+XOFF+YOFF" 100 | msgstr "" 101 | 102 | #: src/dh-main.c:268 103 | msgid "Search for a function" 104 | msgstr "" 105 | 106 | #: src/dh-main.c:277 107 | msgid "Quit any running Devhelp" 108 | msgstr "" 109 | 110 | #: src/dh-parser.c:104 src/dh-parser.c:181 src/dh-parser.c:228 111 | #, c-format 112 | msgid "Expected '%s' got '%s' at line %d, column %d" 113 | msgstr "" 114 | 115 | #: src/dh-parser.c:120 116 | #, c-format 117 | msgid "Invalid namespace '%s' at line %d, column %d" 118 | msgstr "" 119 | 120 | #: src/dh-parser.c:149 121 | #, c-format 122 | msgid "title, name, and link elements are required at line %d, column %d" 123 | msgstr "" 124 | 125 | #: src/dh-parser.c:202 126 | #, c-format 127 | msgid "name and link elements are required inside on line %d, column %d" 128 | msgstr "" 129 | 130 | #: src/dh-parser.c:250 131 | #, c-format 132 | msgid "" 133 | "name and link elements are required inside on line %d, column %d" 134 | msgstr "" 135 | 136 | #: src/dh-parser.c:337 src/dh-parser.c:423 137 | msgid "Could not create book parser" 138 | msgstr "" 139 | 140 | #: src/dh-parser.c:347 src/dh-parser.c:433 141 | msgid "Could not create markup parser" 142 | msgstr "" 143 | 144 | #: src/dh-parser.c:479 145 | #, c-format 146 | msgid "Cannot uncompress book '%s': %s" 147 | msgstr "" 148 | 149 | #: src/dh-search.c:417 150 | #, fuzzy 151 | msgid "_Search:" 152 | msgstr "ಹುಡುಕು" 153 | 154 | #: src/dh-search.c:461 155 | msgid "Section" 156 | msgstr "" 157 | 158 | #: src/dh-window.c:111 159 | msgid "_File" 160 | msgstr "ಕಡತ" 161 | 162 | #: src/dh-window.c:112 163 | msgid "_Edit" 164 | msgstr "" 165 | 166 | #: src/dh-window.c:113 ui/devhelp.glade.h:10 167 | msgid "_Go" 168 | msgstr "ಹೊಗು" 169 | 170 | #: src/dh-window.c:114 171 | msgid "_Help" 172 | msgstr "ಸಹಾಯ" 173 | 174 | #: src/dh-window.c:292 175 | #, c-format 176 | msgid "Cannot set UI: %s" 177 | msgstr "" 178 | 179 | #: src/dh-window.c:352 ui/devhelp.glade.h:3 180 | msgid "Contents" 181 | msgstr "ಒಳ ವಿಷಯಗಳು" 182 | 183 | #: src/dh-window.c:363 184 | msgid "Search" 185 | msgstr "ಹುಡುಕು" 186 | 187 | #: src/dh-window.c:446 188 | msgid "A developer's help browser for GNOME 2" 189 | msgstr "" 190 | 191 | #: src/dh-window.c:462 192 | msgid "Devhelp project page" 193 | msgstr "" 194 | 195 | #: src/dh-window.c:466 196 | msgid "Bug report Devhelp" 197 | msgstr "" 198 | 199 | #: ui/devhelp.glade.h:1 200 | msgid " " 201 | msgstr "" 202 | 203 | #: ui/devhelp.glade.h:2 204 | msgid "Fonts" 205 | msgstr "" 206 | 207 | #: ui/devhelp.glade.h:5 208 | msgid "Fixed width:" 209 | msgstr "" 210 | 211 | #: ui/devhelp.glade.h:6 212 | msgid "Preferences" 213 | msgstr "" 214 | 215 | #: ui/devhelp.glade.h:7 216 | msgid "Variable width: " 217 | msgstr "" 218 | 219 | #: ui/devhelp.glade.h:8 220 | msgid "_Back" 221 | msgstr "" 222 | 223 | #: ui/devhelp.glade.h:9 224 | msgid "_Forward" 225 | msgstr "" 226 | 227 | #: ui/devhelp.glade.h:11 228 | msgid "_Use system fonts" 229 | msgstr "" 230 | 231 | #~ msgid "_Search for:" 232 | #~ msgstr "ಹುಡುಕು:" 233 | 234 | #~ msgid "_About" 235 | #~ msgstr "ತಂತ್ರಾಂಶದ ಬಗ್ಗೆ" 236 | 237 | #~ msgid "Open %s" 238 | #~ msgstr "ತೆಗೆ %s" 239 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | I18N.gettext( 2 | GETTEXT_PACKAGE_NAME, 3 | preset: 'glib' 4 | ) 5 | -------------------------------------------------------------------------------- /src/dh-app.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2012 Aleksander Morgado 3 | * SPDX-FileCopyrightText: 2017 Sébastien Wilmet 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #ifndef DH_APP_H 8 | #define DH_APP_H 9 | 10 | #include 11 | #include "dh-window.h" 12 | 13 | G_BEGIN_DECLS 14 | 15 | #define DH_TYPE_APP (dh_app_get_type ()) 16 | #define DH_APP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DH_TYPE_APP, DhApp)) 17 | #define DH_APP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DH_TYPE_APP, DhAppClass)) 18 | #define DH_IS_APP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DH_TYPE_APP)) 19 | #define DH_IS_APP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DH_TYPE_APP)) 20 | #define DH_APP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DH_TYPE_APP, DhAppClass)) 21 | 22 | typedef struct _DhApp DhApp; 23 | typedef struct _DhAppClass DhAppClass; 24 | 25 | struct _DhApp { 26 | GtkApplication parent_instance; 27 | }; 28 | 29 | struct _DhAppClass { 30 | GtkApplicationClass parent_class; 31 | }; 32 | 33 | GType dh_app_get_type (void) G_GNUC_CONST; 34 | 35 | DhApp * dh_app_new (void); 36 | 37 | DhWindow * dh_app_get_active_main_window (DhApp *app, 38 | gboolean create_if_none); 39 | 40 | G_END_DECLS 41 | 42 | #endif /* DH_APP_H */ 43 | -------------------------------------------------------------------------------- /src/dh-assistant.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2008 Imendio AB 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #include "dh-assistant.h" 7 | #include 8 | #include "dh-settings-app.h" 9 | #include "dh-util-app.h" 10 | #include "dh-window.h" 11 | 12 | typedef struct { 13 | GtkWidget *view; 14 | } DhAssistantPrivate; 15 | 16 | G_DEFINE_TYPE_WITH_PRIVATE (DhAssistant, dh_assistant, GTK_TYPE_APPLICATION_WINDOW); 17 | 18 | static void 19 | assistant_view_open_uri_cb (DhAssistantView *view, 20 | const char *uri, 21 | DhAssistant *assistant) 22 | { 23 | DhApp *app; 24 | DhWindow *window; 25 | 26 | app = DH_APP (gtk_window_get_application (GTK_WINDOW (assistant))); 27 | 28 | window = dh_app_get_active_main_window (app, TRUE); 29 | _dh_window_display_uri (window, uri); 30 | } 31 | 32 | static gboolean 33 | dh_assistant_key_press_event (GtkWidget *widget, 34 | GdkEventKey *event) 35 | { 36 | DhAssistant *assistant = DH_ASSISTANT (widget); 37 | 38 | if (event->keyval == GDK_KEY_Escape) { 39 | gtk_window_close (GTK_WINDOW (assistant)); 40 | return GDK_EVENT_STOP; 41 | } 42 | 43 | return GTK_WIDGET_CLASS (dh_assistant_parent_class)->key_press_event (widget, event); 44 | } 45 | 46 | static gboolean 47 | dh_assistant_delete_event (GtkWidget *widget, 48 | GdkEventAny *event) 49 | { 50 | DhSettingsApp *settings; 51 | 52 | settings = dh_settings_app_get_singleton (); 53 | dh_util_window_settings_save (GTK_WINDOW (widget), 54 | dh_settings_app_peek_assistant_settings (settings)); 55 | 56 | if (GTK_WIDGET_CLASS (dh_assistant_parent_class)->delete_event == NULL) 57 | return GDK_EVENT_PROPAGATE; 58 | 59 | return GTK_WIDGET_CLASS (dh_assistant_parent_class)->delete_event (widget, event); 60 | } 61 | 62 | static void 63 | dh_assistant_class_init (DhAssistantClass *klass) 64 | { 65 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); 66 | 67 | widget_class->key_press_event = dh_assistant_key_press_event; 68 | widget_class->delete_event = dh_assistant_delete_event; 69 | 70 | /* Bind class to template */ 71 | gtk_widget_class_set_template_from_resource (widget_class, 72 | "/org/gnome/devhelp/dh-assistant.ui"); 73 | gtk_widget_class_bind_template_child_private (widget_class, DhAssistant, view); 74 | } 75 | 76 | static void 77 | dh_assistant_init (DhAssistant *assistant) 78 | { 79 | DhAssistantPrivate *priv = dh_assistant_get_instance_private (assistant); 80 | 81 | gtk_widget_init_template (GTK_WIDGET (assistant)); 82 | 83 | g_signal_connect (priv->view, "open-uri", 84 | G_CALLBACK (assistant_view_open_uri_cb), 85 | assistant); 86 | } 87 | 88 | DhAssistant * 89 | dh_assistant_new (DhApp *application) 90 | { 91 | DhAssistant *assistant; 92 | DhSettingsApp *settings; 93 | 94 | assistant = g_object_new (DH_TYPE_ASSISTANT, 95 | "application", application, 96 | NULL); 97 | 98 | settings = dh_settings_app_get_singleton (); 99 | gtk_widget_realize (GTK_WIDGET (assistant)); 100 | dh_util_window_settings_restore (GTK_WINDOW (assistant), 101 | dh_settings_app_peek_assistant_settings (settings)); 102 | 103 | return assistant; 104 | } 105 | 106 | gboolean 107 | dh_assistant_search (DhAssistant *assistant, 108 | const gchar *str) 109 | { 110 | DhAssistantPrivate *priv; 111 | 112 | g_return_val_if_fail (DH_IS_ASSISTANT (assistant), FALSE); 113 | g_return_val_if_fail (str != NULL, FALSE); 114 | 115 | priv = dh_assistant_get_instance_private (assistant); 116 | 117 | if (dh_assistant_view_search (DH_ASSISTANT_VIEW (priv->view), str)) { 118 | gtk_widget_show (GTK_WIDGET (assistant)); 119 | return TRUE; 120 | } 121 | 122 | return FALSE; 123 | } 124 | -------------------------------------------------------------------------------- /src/dh-assistant.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2008 Imendio AB 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #ifndef DH_ASSISTANT_H 7 | #define DH_ASSISTANT_H 8 | 9 | #include 10 | #include "dh-app.h" 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_ASSISTANT (dh_assistant_get_type ()) 15 | #define DH_ASSISTANT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DH_TYPE_ASSISTANT, DhAssistant)) 16 | #define DH_ASSISTANT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DH_TYPE_ASSISTANT, DhAssistantClass)) 17 | #define DH_IS_ASSISTANT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DH_TYPE_ASSISTANT)) 18 | #define DH_IS_ASSISTANT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DH_TYPE_ASSISTANT)) 19 | #define DH_ASSISTANT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DH_TYPE_ASSISTANT, DhAssistantClass)) 20 | 21 | typedef struct _DhAssistant DhAssistant; 22 | typedef struct _DhAssistantClass DhAssistantClass; 23 | 24 | struct _DhAssistant { 25 | GtkApplicationWindow parent_instance; 26 | }; 27 | 28 | struct _DhAssistantClass { 29 | GtkApplicationWindowClass parent_class; 30 | }; 31 | 32 | GType dh_assistant_get_type (void) G_GNUC_CONST; 33 | 34 | DhAssistant * dh_assistant_new (DhApp *application); 35 | 36 | gboolean dh_assistant_search (DhAssistant *assistant, 37 | const gchar *str); 38 | 39 | G_END_DECLS 40 | 41 | #endif /* DH_ASSISTANT_H */ 42 | -------------------------------------------------------------------------------- /src/dh-assistant.ui: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 20 | 21 | -------------------------------------------------------------------------------- /src/dh-main.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2001-2003 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2001-2008 Imendio AB 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #include "config.h" 8 | #include 9 | #include 10 | #include 11 | #include "dh-app.h" 12 | #include "dh-settings-app.h" 13 | 14 | int 15 | main (int argc, char **argv) 16 | { 17 | DhApp *application; 18 | gint status; 19 | 20 | setlocale (LC_ALL, ""); 21 | textdomain (GETTEXT_PACKAGE); 22 | 23 | dh_init (); 24 | 25 | application = dh_app_new (); 26 | status = g_application_run (G_APPLICATION (application), argc, argv); 27 | g_object_unref (application); 28 | 29 | dh_finalize (); 30 | dh_settings_app_unref_singleton (); 31 | 32 | return status; 33 | } 34 | -------------------------------------------------------------------------------- /src/dh-preferences.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2004-2008 Imendio AB 3 | * SPDX-FileCopyrightText: 2010 Lanedo GmbH 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #ifndef DH_PREFERENCES_H 8 | #define DH_PREFERENCES_H 9 | 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_PREFERENCES (dh_preferences_get_type ()) 15 | #define DH_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_PREFERENCES, DhPreferences)) 16 | #define DH_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_PREFERENCES, DhPreferencesClass)) 17 | #define DH_IS_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_PREFERENCES)) 18 | #define DH_IS_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_PREFERENCES)) 19 | #define DH_PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_PREFERENCES, DhPreferencesClass)) 20 | 21 | typedef struct _DhPreferences DhPreferences; 22 | typedef struct _DhPreferencesClass DhPreferencesClass; 23 | 24 | struct _DhPreferences { 25 | GtkDialog parent; 26 | }; 27 | 28 | struct _DhPreferencesClass { 29 | GtkDialogClass parent_class; 30 | }; 31 | 32 | GType dh_preferences_get_type (void); 33 | 34 | void dh_preferences_show_dialog (GtkWindow *parent); 35 | 36 | G_END_DECLS 37 | 38 | #endif /* DH_PREFERENCES_H */ 39 | -------------------------------------------------------------------------------- /src/dh-settings-app.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2012 Thomas Bechtold 3 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #include "dh-settings-app.h" 8 | 9 | /* Devhelp GSettings schema IDs */ 10 | #define SETTINGS_SCHEMA_ID_WINDOW "org.gnome.devhelp.state.main.window" 11 | #define SETTINGS_SCHEMA_ID_PANED "org.gnome.devhelp.state.main.paned" 12 | #define SETTINGS_SCHEMA_ID_ASSISTANT "org.gnome.devhelp.state.assistant.window" 13 | 14 | struct _DhSettingsAppPrivate { 15 | GSettings *settings_window; 16 | GSettings *settings_paned; 17 | GSettings *settings_assistant; 18 | }; 19 | 20 | /* DhSettingsApp is a singleton. */ 21 | static DhSettingsApp *singleton = NULL; 22 | 23 | G_DEFINE_TYPE_WITH_PRIVATE (DhSettingsApp, dh_settings_app, G_TYPE_OBJECT); 24 | 25 | static void 26 | dh_settings_app_dispose (GObject *object) 27 | { 28 | DhSettingsApp *self = DH_SETTINGS_APP (object); 29 | 30 | g_clear_object (&self->priv->settings_window); 31 | g_clear_object (&self->priv->settings_paned); 32 | g_clear_object (&self->priv->settings_assistant); 33 | 34 | G_OBJECT_CLASS (dh_settings_app_parent_class)->dispose (object); 35 | } 36 | 37 | static void 38 | dh_settings_app_finalize (GObject *object) 39 | { 40 | if (singleton == DH_SETTINGS_APP (object)) 41 | singleton = NULL; 42 | 43 | G_OBJECT_CLASS (dh_settings_app_parent_class)->finalize (object); 44 | } 45 | 46 | static void 47 | dh_settings_app_class_init (DhSettingsAppClass *klass) 48 | { 49 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 50 | 51 | object_class->dispose = dh_settings_app_dispose; 52 | object_class->finalize = dh_settings_app_finalize; 53 | } 54 | 55 | static void 56 | dh_settings_app_init (DhSettingsApp *self) 57 | { 58 | self->priv = dh_settings_app_get_instance_private (self); 59 | 60 | self->priv->settings_window = g_settings_new (SETTINGS_SCHEMA_ID_WINDOW); 61 | self->priv->settings_paned = g_settings_new (SETTINGS_SCHEMA_ID_PANED); 62 | self->priv->settings_assistant = g_settings_new (SETTINGS_SCHEMA_ID_ASSISTANT); 63 | } 64 | 65 | DhSettingsApp * 66 | dh_settings_app_get_singleton (void) 67 | { 68 | if (singleton == NULL) 69 | singleton = g_object_new (DH_TYPE_SETTINGS_APP, NULL); 70 | 71 | return singleton; 72 | } 73 | 74 | void 75 | dh_settings_app_unref_singleton (void) 76 | { 77 | if (singleton != NULL) 78 | g_object_unref (singleton); 79 | 80 | /* singleton is not set to NULL here, it is set to NULL in 81 | * dh_settings_app_finalize() (i.e. when we are sure that the ref count 82 | * reaches 0). 83 | */ 84 | } 85 | 86 | GSettings * 87 | dh_settings_app_peek_window_settings (DhSettingsApp *self) 88 | { 89 | g_return_val_if_fail (DH_IS_SETTINGS_APP (self), NULL); 90 | return self->priv->settings_window; 91 | } 92 | 93 | GSettings * 94 | dh_settings_app_peek_paned_settings (DhSettingsApp *self) 95 | { 96 | g_return_val_if_fail (DH_IS_SETTINGS_APP (self), NULL); 97 | return self->priv->settings_paned; 98 | } 99 | 100 | GSettings * 101 | dh_settings_app_peek_assistant_settings (DhSettingsApp *self) 102 | { 103 | g_return_val_if_fail (DH_IS_SETTINGS_APP (self), NULL); 104 | return self->priv->settings_assistant; 105 | } 106 | -------------------------------------------------------------------------------- /src/dh-settings-app.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2012 Thomas Bechtold 3 | * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet 4 | * SPDX-License-Identifier: GPL-3.0-or-later 5 | */ 6 | 7 | #ifndef DH_SETTINGS_APP_H 8 | #define DH_SETTINGS_APP_H 9 | 10 | #include 11 | 12 | G_BEGIN_DECLS 13 | 14 | #define DH_TYPE_SETTINGS_APP (dh_settings_app_get_type ()) 15 | #define DH_SETTINGS_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DH_TYPE_SETTINGS_APP, DhSettingsApp)) 16 | #define DH_IS_SETTINGS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DH_TYPE_SETTINGS_APP)) 17 | #define DH_SETTINGS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DH_TYPE_SETTINGS_APP, DhSettingsAppClass)) 18 | #define DH_IS_SETTINGS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DH_TYPE_SETTINGS_APP)) 19 | #define DH_SETTINGS_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DH_TYPE_SETTINGS_APP, DhSettingsAppClass)) 20 | 21 | typedef struct _DhSettingsApp DhSettingsApp; 22 | typedef struct _DhSettingsAppClass DhSettingsAppClass; 23 | typedef struct _DhSettingsAppPrivate DhSettingsAppPrivate; 24 | 25 | struct _DhSettingsApp { 26 | GObject parent; 27 | DhSettingsAppPrivate *priv; 28 | }; 29 | 30 | struct _DhSettingsAppClass { 31 | GObjectClass parent; 32 | }; 33 | 34 | GType dh_settings_app_get_type (void); 35 | 36 | DhSettingsApp * dh_settings_app_get_singleton (void); 37 | 38 | void dh_settings_app_unref_singleton (void); 39 | 40 | GSettings * dh_settings_app_peek_window_settings (DhSettingsApp *self); 41 | 42 | GSettings * dh_settings_app_peek_paned_settings (DhSettingsApp *self); 43 | 44 | GSettings * dh_settings_app_peek_assistant_settings (DhSettingsApp *self); 45 | 46 | G_END_DECLS 47 | 48 | #endif /* DH_SETTINGS_APP_H */ 49 | -------------------------------------------------------------------------------- /src/dh-util-app.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2001 Mikael Hallendal 3 | * SPDX-FileCopyrightText: 2004, 2008 Imendio AB 4 | * SPDX-FileCopyrightText: 2015, 2017, 2018 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #include "config.h" 9 | 10 | #include "dh-util-app.h" 11 | 12 | static void 13 | introspect_window_gsettings (GSettings *window_settings, 14 | gboolean *has_required_keys, 15 | gboolean *has_maximized_key) 16 | { 17 | GSettingsSchema *schema = NULL; 18 | 19 | g_object_get (window_settings, 20 | "settings-schema", &schema, 21 | NULL); 22 | 23 | *has_required_keys = (g_settings_schema_has_key (schema, "width") && 24 | g_settings_schema_has_key (schema, "height")); 25 | 26 | *has_maximized_key = g_settings_schema_has_key (schema, "maximized"); 27 | 28 | g_settings_schema_unref (schema); 29 | } 30 | 31 | void 32 | dh_util_window_settings_save (GtkWindow *window, 33 | GSettings *settings) 34 | { 35 | gboolean has_required_keys; 36 | gboolean has_maximized_key; 37 | gint width; 38 | gint height; 39 | 40 | g_return_if_fail (GTK_IS_WINDOW (window)); 41 | g_return_if_fail (G_IS_SETTINGS (settings)); 42 | 43 | introspect_window_gsettings (settings, &has_required_keys, &has_maximized_key); 44 | g_return_if_fail (has_required_keys); 45 | 46 | if (has_maximized_key) { 47 | GdkWindowState state; 48 | gboolean maximized; 49 | 50 | state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window))); 51 | maximized = (state & GDK_WINDOW_STATE_MAXIMIZED) != 0; 52 | 53 | g_settings_set_boolean (settings, "maximized", maximized); 54 | 55 | /* If maximized don't save the size. */ 56 | if (maximized) 57 | return; 58 | } 59 | 60 | /* Store the dimensions */ 61 | gtk_window_get_size (GTK_WINDOW (window), &width, &height); 62 | g_settings_set_int (settings, "width", width); 63 | g_settings_set_int (settings, "height", height); 64 | } 65 | 66 | /* This should be called when @gtk_window is realized (i.e. its GdkWindow is 67 | * created) but not yet mapped (i.e. gtk_widget_show() has not yet been called, 68 | * so that when it is shown it already has the good size). 69 | */ 70 | void 71 | dh_util_window_settings_restore (GtkWindow *gtk_window, 72 | GSettings *settings) 73 | { 74 | gboolean has_required_keys; 75 | gboolean has_maximized_key; 76 | gint width; 77 | gint height; 78 | 79 | g_return_if_fail (GTK_IS_WINDOW (gtk_window)); 80 | g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (gtk_window))); 81 | g_return_if_fail (G_IS_SETTINGS (settings)); 82 | 83 | introspect_window_gsettings (settings, &has_required_keys, &has_maximized_key); 84 | g_return_if_fail (has_required_keys); 85 | 86 | width = g_settings_get_int (settings, "width"); 87 | height = g_settings_get_int (settings, "height"); 88 | 89 | if (width > 1 && height > 1) { 90 | GdkDisplay *display; 91 | GdkWindow *gdk_window; 92 | GdkMonitor *monitor; 93 | GdkRectangle monitor_workarea; 94 | gint max_width; 95 | gint max_height; 96 | 97 | display = gtk_widget_get_display (GTK_WIDGET (gtk_window)); 98 | /* To get the GdkWindow the widget must be realized. */ 99 | gdk_window = gtk_widget_get_window (GTK_WIDGET (gtk_window)); 100 | monitor = gdk_display_get_monitor_at_window (display, gdk_window); 101 | gdk_monitor_get_workarea (monitor, &monitor_workarea); 102 | 103 | max_width = monitor_workarea.width; 104 | max_height = monitor_workarea.height; 105 | 106 | width = CLAMP (width, 0, max_width); 107 | height = CLAMP (height, 0, max_height); 108 | 109 | gtk_window_set_default_size (gtk_window, width, height); 110 | } 111 | 112 | if (has_maximized_key && g_settings_get_boolean (settings, "maximized")) 113 | gtk_window_maximize (gtk_window); 114 | } 115 | 116 | gboolean 117 | dh_util_is_devel_build (void) 118 | { 119 | #if DEVEL_BUILD 120 | return TRUE; 121 | #else 122 | return FALSE; 123 | #endif 124 | } 125 | -------------------------------------------------------------------------------- /src/dh-util-app.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2001-2002 Mikael Hallendal 3 | * SPDX-FileCopyrightText: 2004,2008 Imendio AB 4 | * SPDX-FileCopyrightText: 2015, 2017 Sébastien Wilmet 5 | * SPDX-License-Identifier: GPL-3.0-or-later 6 | */ 7 | 8 | #ifndef DH_UTIL_APP_H 9 | #define DH_UTIL_APP_H 10 | 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | void dh_util_window_settings_save (GtkWindow *window, 16 | GSettings *settings); 17 | 18 | void dh_util_window_settings_restore (GtkWindow *gtk_window, 19 | GSettings *settings); 20 | 21 | gboolean dh_util_is_devel_build (void); 22 | 23 | G_END_DECLS 24 | 25 | #endif /* DH_UTIL_APP_H */ 26 | -------------------------------------------------------------------------------- /src/dh-window.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2002 CodeFactory AB 3 | * SPDX-FileCopyrightText: 2001-2002 Mikael Hallendal 4 | * SPDX-FileCopyrightText: 2005 Imendio AB 5 | * SPDX-FileCopyrightText: 2017-2018 Sébastien Wilmet 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | */ 8 | 9 | #ifndef DH_WINDOW_H 10 | #define DH_WINDOW_H 11 | 12 | #include 13 | 14 | G_BEGIN_DECLS 15 | 16 | #define DH_TYPE_WINDOW (dh_window_get_type ()) 17 | #define DH_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DH_TYPE_WINDOW, DhWindow)) 18 | #define DH_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DH_TYPE_WINDOW, DhWindowClass)) 19 | #define DH_IS_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DH_TYPE_WINDOW)) 20 | #define DH_IS_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DH_TYPE_WINDOW)) 21 | #define DH_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DH_TYPE_WINDOW, DhWindowClass)) 22 | 23 | typedef struct _DhWindow DhWindow; 24 | typedef struct _DhWindowClass DhWindowClass; 25 | 26 | struct _DhWindow { 27 | GtkApplicationWindow parent_instance; 28 | }; 29 | 30 | struct _DhWindowClass { 31 | GtkApplicationWindowClass parent_class; 32 | }; 33 | 34 | GType dh_window_get_type (void) G_GNUC_CONST; 35 | 36 | GtkWidget * dh_window_new (GtkApplication *application); 37 | 38 | void dh_window_search (DhWindow *window, 39 | const gchar *str); 40 | 41 | void _dh_window_display_uri (DhWindow *window, 42 | const gchar *uri); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* DH_WINDOW_H */ 47 | -------------------------------------------------------------------------------- /src/dh.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | dh-assistant.ui 13 | dh-preferences.ui 14 | dh-window.ui 15 | 16 | 17 | help-overlay.ui 18 | 19 | 20 | ../data/icons/view-left-pane-symbolic.svg 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2018 Sébastien Wilmet 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | devhelp_app_sources = [ 5 | 'dh-app.c', 6 | 'dh-assistant.c', 7 | 'dh-main.c', 8 | 'dh-preferences.c', 9 | 'dh-settings-app.c', 10 | 'dh-util-app.c', 11 | 'dh-window.c' 12 | ] 13 | 14 | devhelp_app_sources += GNOME.compile_resources( 15 | 'dh-resources', 16 | 'dh.gresource.xml' 17 | ) 18 | 19 | executable( 20 | 'devhelp', 21 | devhelp_app_sources, 22 | dependencies: [DEVHELP_APP_DEPS, LIBDEVHELP_SHARED_LIB_DEP], 23 | install: true 24 | ) 25 | -------------------------------------------------------------------------------- /subprojects/gi-docgen.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory=gi-docgen 3 | url=https://gitlab.gnome.org/GNOME/gi-docgen.git 4 | push-url=ssh://git@gitlab.gnome.org:GNOME/gi-docgen.git 5 | revision=main 6 | depth=1 7 | -------------------------------------------------------------------------------- /unit-tests/meson.build: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2018 Sébastien Wilmet 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | unit_tests = [ 5 | 'test-completion', 6 | 'test-link', 7 | 'test-search-context', 8 | 'test-util' 9 | ] 10 | 11 | foreach test_name : unit_tests 12 | test_exe = executable( 13 | test_name, 14 | test_name + '.c', 15 | dependencies: LIBDEVHELP_STATIC_DEP 16 | ) 17 | test(test_name, test_exe) 18 | endforeach 19 | -------------------------------------------------------------------------------- /unit-tests/test-link.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2017 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #include 7 | 8 | #define DEVHELP_BOOK_BASE_PATH "/usr/share/gtk-doc/html/devhelp" 9 | 10 | static void 11 | check_belongs_to_page_book_link (DhLink *book_link) 12 | { 13 | g_assert (dh_link_belongs_to_page (book_link, "index")); 14 | g_assert (!dh_link_belongs_to_page (book_link, "Index")); 15 | g_assert (!dh_link_belongs_to_page (book_link, "")); 16 | g_assert (!dh_link_belongs_to_page (book_link, "kiwi")); 17 | } 18 | 19 | static void 20 | test_belongs_to_page (void) 21 | { 22 | DhLink *book_link; 23 | DhLink *link; 24 | 25 | /* index.html */ 26 | book_link = dh_link_new_book (DEVHELP_BOOK_BASE_PATH, 27 | "devhelp", 28 | "Devhelp Reference Manual", 29 | "index.html"); 30 | check_belongs_to_page_book_link (book_link); 31 | dh_link_unref (book_link); 32 | 33 | /* Empty relative_url */ 34 | book_link = dh_link_new_book (DEVHELP_BOOK_BASE_PATH, 35 | "devhelp", 36 | "Devhelp Reference Manual", 37 | ""); 38 | check_belongs_to_page_book_link (book_link); 39 | 40 | /* A function */ 41 | link = dh_link_new (DH_LINK_TYPE_FUNCTION, 42 | book_link, 43 | "dh_link_ref", 44 | "DhLink.html#dh-link-ref"); 45 | 46 | g_assert (dh_link_belongs_to_page (link, "DhLink")); 47 | g_assert (!dh_link_belongs_to_page (link, "dhlink")); 48 | g_assert (!dh_link_belongs_to_page (link, "")); 49 | g_assert (!dh_link_belongs_to_page (link, "kiwi")); 50 | 51 | dh_link_unref (book_link); 52 | dh_link_unref (link); 53 | } 54 | 55 | int 56 | main (int argc, 57 | char **argv) 58 | { 59 | g_test_init (&argc, &argv, NULL); 60 | 61 | g_test_add_func ("/link/belongs_to_page", test_belongs_to_page); 62 | 63 | return g_test_run (); 64 | } 65 | -------------------------------------------------------------------------------- /unit-tests/test-util.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 | /* SPDX-FileCopyrightText: 2017 Sébastien Wilmet 3 | * SPDX-License-Identifier: GPL-3.0-or-later 4 | */ 5 | 6 | #include "devhelp/dh-util-lib.h" 7 | 8 | static void 9 | check_get_possible_index_files (const gchar *book_directory_path, 10 | const gchar *book_basename) 11 | { 12 | GFile *book_directory; 13 | GSList *list; 14 | GSList *l; 15 | gint i; 16 | 17 | book_directory = g_file_new_for_path (book_directory_path); 18 | list = _dh_util_get_possible_index_files (book_directory); 19 | 20 | g_assert_cmpint (g_slist_length (list), ==, 4); 21 | 22 | for (l = list, i = 0; l != NULL; l = l->next, i++) { 23 | GFile *index_file = G_FILE (l->data); 24 | gchar *expected_basename; 25 | gchar *basename; 26 | gchar *expected_path; 27 | const gchar *path; 28 | 29 | switch (i) { 30 | case 0: 31 | expected_basename = g_strconcat (book_basename, ".devhelp2", NULL); 32 | break; 33 | 34 | case 1: 35 | expected_basename = g_strconcat (book_basename, ".devhelp2.gz", NULL); 36 | break; 37 | 38 | case 2: 39 | expected_basename = g_strconcat (book_basename, ".devhelp", NULL); 40 | break; 41 | 42 | case 3: 43 | expected_basename = g_strconcat (book_basename, ".devhelp.gz", NULL); 44 | break; 45 | 46 | default: 47 | g_assert_not_reached (); 48 | } 49 | 50 | basename = g_file_get_basename (index_file); 51 | g_assert_cmpstr (basename, ==, expected_basename); 52 | 53 | expected_path = g_build_filename (book_directory_path, expected_basename, NULL); 54 | path = g_file_peek_path (index_file); 55 | g_assert_cmpstr (path, ==, expected_path); 56 | 57 | g_free (expected_basename); 58 | g_free (basename); 59 | g_free (expected_path); 60 | } 61 | 62 | g_object_unref (book_directory); 63 | g_slist_free_full (list, g_object_unref); 64 | } 65 | 66 | static void 67 | test_get_possible_index_files (void) 68 | { 69 | check_get_possible_index_files ("/usr/share/gtk-doc/html/glib", "glib"); 70 | check_get_possible_index_files ("/usr/share/gtk-doc/html/glib/", "glib"); 71 | check_get_possible_index_files ("/usr/share/gtk-doc/html/gtk3", "gtk3"); 72 | check_get_possible_index_files ("/usr/share/gtk-doc/html/gtk3/", "gtk3"); 73 | } 74 | 75 | int 76 | main (int argc, 77 | char **argv) 78 | { 79 | g_test_init (&argc, &argv, NULL); 80 | 81 | g_test_add_func ("/util/get_possible_index_files", test_get_possible_index_files); 82 | 83 | return g_test_run (); 84 | } 85 | --------------------------------------------------------------------------------