Remove builtin settings search provider
It is now provided as a remote provider by gnome-control-center. https://bugzilla.gnome.org/show_bug.cgi?id=690824
This commit is contained in:
parent
824fbe09c2
commit
3044a6b517
@ -366,44 +366,6 @@ const AppSearchProvider = new Lang.Class({
|
||||
}
|
||||
});
|
||||
|
||||
const SettingsSearchProvider = new Lang.Class({
|
||||
Name: 'SettingsSearchProvider',
|
||||
|
||||
_init: function() {
|
||||
this.appInfo = Gio.DesktopAppInfo.new('gnome-control-center.desktop');
|
||||
this._appSys = Shell.AppSystem.get_default();
|
||||
},
|
||||
|
||||
getResultMetas: function(prefs, callback) {
|
||||
let metas = [];
|
||||
for (let i = 0; i < prefs.length; i++) {
|
||||
let pref = prefs[i];
|
||||
metas.push({ 'id': pref,
|
||||
'name': pref.get_name(),
|
||||
'createIcon': function() { return null; }
|
||||
});
|
||||
}
|
||||
callback(metas);
|
||||
},
|
||||
|
||||
getInitialResultSet: function(terms) {
|
||||
this.searchSystem.pushResults(this, this._appSys.search_settings(terms));
|
||||
},
|
||||
|
||||
getSubsearchResultSet: function(previousResults, terms) {
|
||||
this.searchSystem.pushResults(this, this._appSys.search_settings(terms));
|
||||
},
|
||||
|
||||
activateResult: function(pref) {
|
||||
pref.activate();
|
||||
},
|
||||
|
||||
launchSearch: function(terms) {
|
||||
// FIXME: this should be a remote search provider
|
||||
this.appInfo.launch([], global.create_app_launch_context());
|
||||
}
|
||||
});
|
||||
|
||||
const AppIcon = new Lang.Class({
|
||||
Name: 'AppIcon',
|
||||
Extends: IconGrid.BaseIcon,
|
||||
|
@ -123,6 +123,10 @@ function loadRemoteSearchProvider(file, info, data) {
|
||||
function remoteProvidersLoaded(loadState) {
|
||||
let searchSettings = new Gio.Settings({ schema: Search.SEARCH_PROVIDERS_SCHEMA });
|
||||
let sortOrder = searchSettings.get_strv('sort-order');
|
||||
|
||||
// Special case gnome-control-center to be always active and always first
|
||||
sortOrder.unshift('gnome-control-center.desktop');
|
||||
|
||||
let numSorted = sortOrder.length;
|
||||
|
||||
loadState.loadedProviders.sort(
|
||||
|
@ -114,7 +114,6 @@ const ViewSelector = new Lang.Class({
|
||||
// Wanda comes obviously first
|
||||
this.addSearchProvider(new Wanda.WandaSearchProvider());
|
||||
this.addSearchProvider(new AppDisplay.AppSearchProvider());
|
||||
this.addSearchProvider(new AppDisplay.SettingsSearchProvider());
|
||||
|
||||
// Load remote search providers provided by applications
|
||||
RemoteSearch.loadRemoteSearchProviders(Lang.bind(this, this.addSearchProvider));
|
||||
|
@ -45,14 +45,10 @@ struct _ShellAppSystemPrivate {
|
||||
GHashTable *id_to_app;
|
||||
|
||||
GSList *known_vendor_prefixes;
|
||||
|
||||
GMenuTree *settings_tree;
|
||||
GHashTable *setting_id_to_app;
|
||||
};
|
||||
|
||||
static void shell_app_system_finalize (GObject *object);
|
||||
static void on_apps_tree_changed_cb (GMenuTree *tree, gpointer user_data);
|
||||
static void on_settings_tree_changed_cb (GMenuTree *tree, gpointer user_data);
|
||||
|
||||
G_DEFINE_TYPE(ShellAppSystem, shell_app_system, G_TYPE_OBJECT);
|
||||
|
||||
@ -97,20 +93,12 @@ shell_app_system_init (ShellAppSystem *self)
|
||||
/* All the objects in this hash table are owned by id_to_app */
|
||||
priv->visible_id_to_app = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
priv->setting_id_to_app = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
NULL,
|
||||
(GDestroyNotify)g_object_unref);
|
||||
|
||||
/* We want to track NoDisplay apps, so we add INCLUDE_NODISPLAY. We'll
|
||||
* filter NoDisplay apps out when showing them to the user. */
|
||||
priv->apps_tree = gmenu_tree_new ("applications.menu", GMENU_TREE_FLAGS_INCLUDE_NODISPLAY);
|
||||
g_signal_connect (priv->apps_tree, "changed", G_CALLBACK (on_apps_tree_changed_cb), self);
|
||||
|
||||
priv->settings_tree = gmenu_tree_new ("gnomecc.menu", 0);
|
||||
g_signal_connect (priv->settings_tree, "changed", G_CALLBACK (on_settings_tree_changed_cb), self);
|
||||
|
||||
on_apps_tree_changed_cb (priv->apps_tree, self);
|
||||
on_settings_tree_changed_cb (priv->settings_tree, self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -120,12 +108,10 @@ shell_app_system_finalize (GObject *object)
|
||||
ShellAppSystemPrivate *priv = self->priv;
|
||||
|
||||
g_object_unref (priv->apps_tree);
|
||||
g_object_unref (priv->settings_tree);
|
||||
|
||||
g_hash_table_destroy (priv->running_apps);
|
||||
g_hash_table_destroy (priv->id_to_app);
|
||||
g_hash_table_destroy (priv->visible_id_to_app);
|
||||
g_hash_table_destroy (priv->setting_id_to_app);
|
||||
|
||||
g_slist_free_full (priv->known_vendor_prefixes, g_free);
|
||||
priv->known_vendor_prefixes = NULL;
|
||||
@ -404,48 +390,6 @@ on_apps_tree_changed_cb (GMenuTree *tree,
|
||||
g_signal_emit (self, signals[INSTALLED_CHANGED], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
on_settings_tree_changed_cb (GMenuTree *tree,
|
||||
gpointer user_data)
|
||||
{
|
||||
ShellAppSystem *self = SHELL_APP_SYSTEM (user_data);
|
||||
GError *error = NULL;
|
||||
GHashTable *new_settings;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
g_assert (tree == self->priv->settings_tree);
|
||||
|
||||
g_hash_table_remove_all (self->priv->setting_id_to_app);
|
||||
if (!gmenu_tree_load_sync (self->priv->settings_tree, &error))
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
g_warning ("Failed to load apps: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Failed to load apps");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
new_settings = get_flattened_entries_from_tree (tree);
|
||||
|
||||
g_hash_table_iter_init (&iter, new_settings);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
const char *id = key;
|
||||
GMenuTreeEntry *entry = value;
|
||||
ShellApp *app;
|
||||
|
||||
app = _shell_app_new (entry);
|
||||
g_hash_table_replace (self->priv->setting_id_to_app, (char*)id, app);
|
||||
}
|
||||
g_hash_table_destroy (new_settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_system_get_tree:
|
||||
*
|
||||
@ -798,18 +742,3 @@ shell_app_system_subsearch (ShellAppSystem *system,
|
||||
return sort_and_concat_results (system, prefix_results, substring_results);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_system_search_settings:
|
||||
* @system: A #ShellAppSystem
|
||||
* @terms: (element-type utf8): List of terms, logical AND
|
||||
*
|
||||
* Search through settings for the given search terms.
|
||||
*
|
||||
* Returns: (transfer container) (element-type ShellApp): List of setting applications
|
||||
*/
|
||||
GSList *
|
||||
shell_app_system_search_settings (ShellAppSystem *self,
|
||||
GSList *terms)
|
||||
{
|
||||
return search_tree (self, terms, self->priv->setting_id_to_app);
|
||||
}
|
||||
|
@ -60,7 +60,4 @@ GSList *shell_app_system_subsearch (ShellAppSystem *sys
|
||||
GSList *previous_results,
|
||||
GSList *terms);
|
||||
|
||||
GSList *shell_app_system_search_settings (ShellAppSystem *system,
|
||||
GSList *terms);
|
||||
|
||||
#endif /* __SHELL_APP_SYSTEM_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user