This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Always refresh recent projects when searching"
Refreshing in the initial search took too long, making GNOME ignore our results, which had weird effects on the user interface. Notably, enter- ing a full term would often show no results, and removing a single letter then gave the desired result. This reverts commit ea9c17f and the changes done in GH-55
- Loading branch information
Showing
5 changed files
with
121 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright Sebastian Wiesner <[email protected]> | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
//! Reload all recent projects across all exposed provider interfaces. | ||
|
||
use crate::providers::PROVIDERS; | ||
use crate::searchprovider::JetbrainsProductSearchProvider; | ||
use tracing::{event, instrument, Level}; | ||
use zbus::{interface, ObjectServer}; | ||
|
||
#[derive(Debug)] | ||
pub struct ReloadAll; | ||
|
||
#[interface(name = "de.swsnr.searchprovider.ReloadAll")] | ||
impl ReloadAll { | ||
/// Reload all recent projects in all registered search providers.. | ||
#[instrument(skip(self, server))] | ||
pub async fn reload_all( | ||
&self, | ||
#[zbus(object_server)] server: &ObjectServer, | ||
) -> zbus::fdo::Result<()> { | ||
event!( | ||
Level::DEBUG, | ||
"Reloading recent projects of all registered search providers" | ||
); | ||
let mut is_failed = false; | ||
for provider in PROVIDERS { | ||
match server | ||
.interface::<_, JetbrainsProductSearchProvider>(provider.objpath()) | ||
.await | ||
{ | ||
Err(error) => { | ||
event!( | ||
Level::DEBUG, | ||
"Skipping {} ({}): {error}", | ||
provider.label, | ||
provider.desktop_id | ||
); | ||
} | ||
Ok(search_provider_interface) => { | ||
if let Err(error) = search_provider_interface | ||
.get_mut() | ||
.await | ||
.reload_recent_projects() | ||
{ | ||
is_failed = true; | ||
let iface = search_provider_interface.get().await; | ||
let app_id = iface.app().id(); | ||
event!(Level::ERROR, %app_id, "Failed to reload recent projects of {}: {}", app_id, error); | ||
} | ||
} | ||
} | ||
} | ||
if is_failed { | ||
Err(zbus::fdo::Error::Failed( | ||
"Failed to reload recent projects of some providers".to_string(), | ||
)) | ||
} else { | ||
Ok(()) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters