@@ -5,6 +5,10 @@ import GLib from "gi://GLib";
55import WebKit from "gi://WebKit" ;
66import { decode } from "./util.js" ;
77import resource from "./DocumentationViewer.blp" ;
8+ import {
9+ action_extensions ,
10+ isDocumentationEnabled ,
11+ } from "./Extensions/Extensions.js" ;
812
913const DocumentationPage = GObject . registerClass (
1014 {
@@ -56,8 +60,6 @@ export default function DocumentationViewer({ application }) {
5660 const search_page = builder . get_object ( "search_page" ) ;
5761 const search_entry = builder . get_object ( "search_entry" ) ;
5862
59- const base_path = Gio . File . new_for_path ( "/app/share/doc" ) ;
60-
6163 const user_content_manager = webview . get_user_content_manager ( ) ;
6264
6365 const stylesheet = new WebKit . UserStyleSheet (
@@ -118,23 +120,26 @@ export default function DocumentationViewer({ application }) {
118120
119121 async function open ( ) {
120122 const root_model = Gio . ListStore . new ( DocumentationPage ) ;
123+ browse_list_view . model = createBrowseSelectionModel ( root_model , webview ) ;
121124
122- scanLibraries ( root_model , base_path )
123- . then ( ( ) => {
124- browse_list_view . model . selected = 12 ;
125- const search_model = flattenModel ( root_model ) ;
126- filter_model . model = search_model ;
127- } )
128- . catch ( console . error ) ;
125+ await scanLibraries ( root_model , Gio . File . new_for_path ( "/usr/share/doc" ) ) ;
126+ browse_list_view . model . selected = 12 ;
127+ await scanLibraries ( root_model , Gio . File . new_for_path ( "/app/share/doc" ) ) ;
129128
130- browse_list_view . model = createBrowseSelectionModel ( root_model , webview ) ;
129+ const search_model = flattenModel ( root_model ) ;
130+ filter_model . model = search_model ;
131131 }
132132
133133 const action_documentation = new Gio . SimpleAction ( {
134134 name : "documentation" ,
135135 parameter_type : null ,
136136 } ) ;
137137 action_documentation . connect ( "activate" , ( ) => {
138+ if ( ! isDocumentationEnabled ( ) ) {
139+ action_extensions . activate ( null ) ;
140+ return ;
141+ }
142+
138143 window . present ( ) ;
139144 open ( ) . catch ( console . error ) ;
140145 } ) ;
0 commit comments