@@ -143,24 +143,11 @@ impl Window {
143143 & * imp. style_provider . borrow ( ) ,
144144 gtk:: STYLE_PROVIDER_PRIORITY_APPLICATION ,
145145 ) ;
146- this. bind_signals ( ) ;
147146 this. squeezer_changed ( ) ;
148147 this. setup_actions_signals ( ) ;
149148 this. open_in_new_tab ( bookmarks_url ( ) . as_str ( ) ) ;
150149 this
151150 }
152- fn bind_signals ( & self ) {
153- self . imp ( ) . tab_view . connect_selected_page_notify (
154- clone ! ( @weak self as this => @default -panic, move |tab_view| {
155- this. page_switched( tab_view) ;
156- } ) ,
157- ) ;
158- self . imp ( ) . squeezer . connect_visible_child_notify (
159- clone ! ( @weak self as this => @default -panic, move |_sq| {
160- this. squeezer_changed( ) ;
161- } ) ,
162- ) ;
163- }
164151 fn setup_actions_signals ( & self ) {
165152 let imp = self . imp ( ) ;
166153
@@ -224,6 +211,28 @@ impl Window {
224211 None
225212 } ) ,
226213 ) ;
214+
215+ imp. tab_view . connect_selected_page_notify (
216+ clone ! ( @weak self as this => @default -panic, move |tab_view| {
217+ this. page_switched( tab_view) ;
218+ } ) ,
219+ ) ;
220+ imp. squeezer . connect_visible_child_notify (
221+ clone ! ( @weak self as this => @default -panic, move |_sq| {
222+ this. squeezer_changed( ) ;
223+ } ) ,
224+ ) ;
225+ imp. url_bar . connect_activate (
226+ clone ! ( @weak self as this => @default -panic, move |_sq| {
227+ this. open_omni( this. imp( ) . url_bar. text( ) . as_str( ) ) ;
228+ } )
229+ ) ;
230+ imp. small_url_bar . connect_activate (
231+ clone ! ( @weak self as this => @default -panic, move |_sq| {
232+ this. open_omni( this. imp( ) . small_url_bar. text( ) . as_str( ) ) ;
233+ } )
234+ ) ;
235+
227236 adw:: StyleManager :: default ( ) . connect_dark_notify ( clone ! ( @weak self as this => @default -panic, move |_| {
228237 this. set_special_color_from_hash( ) ;
229238 } ) ) ;
@@ -346,15 +355,11 @@ impl Window {
346355 }
347356 } ) ;
348357 }
349- // this should also handle search requests
350358 fn open_omni ( & self , v : & str ) {
351- let url = Url :: parse ( v) ;
359+ let url = Url :: parse ( v) . or_else ( |_| Url :: parse ( & format ! ( "gemini://geminispace.info/search?{}" , v ) ) ) ;
352360 match url {
353361 Ok ( url) => self . current_tab ( ) . spawn_open_url ( url) ,
354- Err ( e) => error ! (
355- "Failed to parse url (will trigger a search in the future): {:?}" ,
356- e
357- ) ,
362+ Err ( e) => error ! ( "Failed to open from omni bar" ) ,
358363 }
359364 }
360365 fn open_url_str ( & self , v : & str ) {
0 commit comments