diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2013-08-18 21:59:49 +0800 |
---|---|---|
committer | Giovanni Campagna <gcampagn@redhat.com> | 2013-08-29 23:43:54 +0800 |
commit | f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3 (patch) | |
tree | a2923f9933c9e1672371d6d40288a82be26ce3ff /src | |
parent | 77df45f51f70243aaad5ec88b816c881cfdb2dbe (diff) | |
download | gsoc2013-epiphany-f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3.tar gsoc2013-epiphany-f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3.tar.gz gsoc2013-epiphany-f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3.tar.bz2 gsoc2013-epiphany-f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3.tar.lz gsoc2013-epiphany-f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3.tar.xz gsoc2013-epiphany-f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3.tar.zst gsoc2013-epiphany-f8f38cb1bbf42e91e5ce5ad4b50caea70d6a08e3.zip |
Add a shell search provider
The search provider offers the same results as the inline completion
in the location bar, gathering results from the history and from
bookmarks. Also, it provides a special "Search the web" item, that
continues search with the configured search engine (Google by default)
https://bugzilla.gnome.org/show_bug.cgi?id=694943
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 19 | ||||
-rw-r--r-- | src/ephy-search-provider.c | 422 | ||||
-rw-r--r-- | src/ephy-search-provider.h | 55 | ||||
-rw-r--r-- | src/ephy-shell.c | 43 | ||||
-rw-r--r-- | src/org.gnome.ShellSearchProvider2.xml | 87 |
5 files changed, 626 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index b7e6448ad..0046e6789 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,6 +7,7 @@ noinst_LTLIBRARIES = libephymain.la bin_PROGRAMS = epiphany EXTRA_DIST = \ + org.gnome.ShellSearchProvider2.xml \ epiphany.gresource.xml \ $(RESOURCE_FILES) \ $(NULL) @@ -25,6 +26,7 @@ NOINST_H_FILES = \ ephy-navigation-history-action.h \ ephy-page-menu-action.h \ ephy-private.h \ + ephy-search-provider.h \ ephy-toolbar.h \ ephy-window-action.h \ languages.h \ @@ -42,6 +44,7 @@ INST_H_FILES = \ $(NULL) libephymain_la_SOURCES = \ + $(dbus_shell_search_provider_built_sources) \ ephy-action-helper.c \ ephy-completion-model.c \ ephy-completion-model.h \ @@ -58,6 +61,7 @@ libephymain_la_SOURCES = \ ephy-navigation-history-action.c \ ephy-notebook.c \ ephy-page-menu-action.c \ + ephy-search-provider.c \ ephy-session.c \ ephy-shell.c \ ephy-toolbar.c \ @@ -123,6 +127,7 @@ EPIPHANY_RESOURCES = \ $(NULL) BUILT_SOURCES = \ + $(dbus_shell_search_provider_built_sources) \ $(EPIPHANY_RESOURCES) \ $(TYPES_SOURCE) \ $(NULL) @@ -212,6 +217,20 @@ stamp-ephy-type-builtins.h: Makefile $(INST_H_FILES) $(NOINST_H_FILES) && rm -f xgen-$(@F) \ && echo timestamp > $(@F) +dbus_shell_search_provider_built_sources = \ + ephy-shell-search-provider-generated.c \ + ephy-shell-search-provider-generated.h + +# The upstream for the DBus interface definition is +# at http://git.gnome.org/browse/gnome-shell/plain/data/org.gnome.ShellSearchProvider2.xml +$(dbus_shell_search_provider_built_sources) : Makefile.am $(srcdir)/org.gnome.ShellSearchProvider2.xml + gdbus-codegen \ + --interface-prefix org.gnome. \ + --c-namespace Ephy \ + --generate-c-code ephy-shell-search-provider-generated \ + $(srcdir)/org.gnome.ShellSearchProvider2.xml \ + $(NULL) + CLEANFILES = $(stamp_files) $(BUILT_SOURCES) DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES) MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES) diff --git a/src/ephy-search-provider.c b/src/ephy-search-provider.c new file mode 100644 index 000000000..2f2ba47ce --- /dev/null +++ b/src/ephy-search-provider.c @@ -0,0 +1,422 @@ +/* + * Copyright (c) 2013 Giovanni Campagna <scampa.giovanni@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the Control Center; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "config.h" + +#include "ephy-search-provider.h" + +#include "ephy-bookmarks.h" +#include "ephy-completion-model.h" +#include "ephy-file-helpers.h" +#include "ephy-history-service.h" +#include "ephy-prefs.h" +#include "ephy-profile-utils.h" +#include "ephy-shell.h" + +#include <string.h> +#include <glib/gi18n.h> +#include <gio/gio.h> +#include <gio/gdesktopappinfo.h> +#include <gtk/gtk.h> +#include <gdk-pixbuf/gdk-pixbuf.h> +#include <libsoup/soup.h> + +struct _EphySearchProvider +{ + GObject parent; + + EphyShellSearchProvider2 *skeleton; + GCancellable *cancellable; + + GSettings *settings; + EphyCompletionModel *model; +}; + +struct _EphySearchProviderClass +{ + GObjectClass parent_class; +}; + +G_DEFINE_TYPE (EphySearchProvider, ephy_search_provider, G_TYPE_OBJECT); + +static void +on_model_updated (EphyHistoryService *service, + gboolean success, + gpointer result_data, + gpointer user_data) +{ + GTask *task = user_data; + EphySearchProvider *self = g_task_get_source_object (task); + GtkTreeModel *model = GTK_TREE_MODEL (self->model); + GtkTreeIter iter; + GPtrArray *results; + const char *search_string; + gboolean ok; + + results = g_ptr_array_new (); + + ok = gtk_tree_model_get_iter_first (model, &iter); + while (ok) { + char *result; + + result = gtk_tree_model_get_string_from_iter (model, &iter); + g_ptr_array_add (results, result); + + ok = gtk_tree_model_iter_next (model, &iter); + } + + search_string = g_task_get_task_data (task); + g_ptr_array_add (results, g_strdup_printf ("special:search:%s", search_string)); + g_ptr_array_add (results, NULL); + + g_task_return_pointer (task, + g_ptr_array_free (results, FALSE), + (GDestroyNotify) g_strfreev); +} + +static char ** +gather_results_finish (EphySearchProvider *self, + GAsyncResult *result, + GError **error) +{ + return g_task_propagate_pointer (G_TASK (result), error); +} + +static void +gather_results_async (EphySearchProvider *self, + char **terms, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GTask *task; + char *search_string; + + task = g_task_new (self, cancellable, callback, user_data); + g_task_set_check_cancellable (task, TRUE); + + search_string = g_strjoinv (" ", terms); + g_task_set_task_data (task, search_string, g_free); + + ephy_completion_model_update_for_string (self->model, + search_string, + on_model_updated, + task); +} + +static void +complete_request (GObject *object, + GAsyncResult *result, + gpointer user_data) +{ + EphySearchProvider *self = EPHY_SEARCH_PROVIDER (object); + char **results; + GError *error; + + error = NULL; + results = gather_results_finish (self, result, &error); + + if (results) { + g_dbus_method_invocation_return_value (user_data, + g_variant_new ("(^as)", results)); + } else { + g_dbus_method_invocation_take_error (user_data, error); + } + + g_application_release (G_APPLICATION (ephy_shell_get_default ())); +} + +static gboolean +handle_get_initial_result_set (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **terms, + EphySearchProvider *self) +{ + g_application_hold (G_APPLICATION (ephy_shell_get_default ())); + g_cancellable_reset (self->cancellable); + + gather_results_async (self, terms, self->cancellable, + complete_request, invocation); + + return TRUE; +} + +static gboolean +handle_get_subsearch_result_set (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **previous_results, + char **terms, + EphySearchProvider *self) +{ + g_application_hold (G_APPLICATION (ephy_shell_get_default ())); + g_cancellable_reset (self->cancellable); + + gather_results_async (self, terms, self->cancellable, + complete_request, invocation); + + return TRUE; +} + +static gboolean +handle_get_result_metas (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **results, + EphySearchProvider *self) +{ + GtkTreeModel *model = GTK_TREE_MODEL (self->model); + GtkTreeIter iter; + int i; + GVariantBuilder builder; + GIcon *favicon; + char *name, *url; + gboolean is_bookmark; + + g_application_hold (G_APPLICATION (ephy_shell_get_default ())); + g_cancellable_cancel (self->cancellable); + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}")); + + for (i = 0; results[i]; i++) + { + if (g_str_has_prefix (results[i], "special:search:") == 0) { + g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_add (&builder, "{sv}", + "id", g_variant_new_string ("special:search")); + g_variant_builder_add (&builder, "{sv}", + "name", g_variant_new_take_string (g_strdup_printf(_("Search the Web for %s"), + results[i] + strlen("special:search:")))); + g_variant_builder_add (&builder, "{sv}", + "gicon", g_variant_new_string ("web-browser")); + g_variant_builder_close (&builder); + continue; + } + + if (!gtk_tree_model_get_iter_from_string (model, &iter, results[i])) + continue; + + gtk_tree_model_get (model, &iter, + EPHY_COMPLETION_TEXT_COL, &name, + EPHY_COMPLETION_URL_COL, &url, + EPHY_COMPLETION_FAVICON_COL, &favicon, + EPHY_COMPLETION_EXTRA_COL, &is_bookmark, + -1); + + g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_add (&builder, "{sv}", + "id", g_variant_new_string (url)); + g_variant_builder_add (&builder, "{sv}", + "name", g_variant_new_string (name)); + + if (favicon == NULL) { + char *type; + + type = g_content_type_from_mime_type ("text/html"); + favicon = g_content_type_get_icon (type); + + if (is_bookmark) { + GEmblem *emblem; + GIcon *emblem_icon, *emblemed; + + emblem_icon = g_themed_icon_new ("emblem-favorite"); + emblem = g_emblem_new (emblem_icon); + + emblemed = g_emblemed_icon_new (favicon, emblem); + + g_object_unref (emblem); + g_object_unref (emblem_icon); + g_object_unref (favicon); + favicon = emblemed; + } + } + + g_variant_builder_add (&builder, "{sv}", + "icon", g_icon_serialize (favicon)); + g_variant_builder_close (&builder); + + g_object_unref (favicon); + g_free (name); + g_free (url); + } + + ephy_shell_search_provider2_complete_get_result_metas (skeleton, + invocation, + g_variant_builder_end (&builder)); + + g_application_release (G_APPLICATION (ephy_shell_get_default ())); + + return TRUE; +} + +static void +launch_uri (const char *uri, + guint timestamp) +{ + const char *uris[2]; + + uris[0] = uri; + uris[1] = NULL; + + ephy_shell_open_uris (ephy_shell_get_default (), uris, 0, timestamp); +} + +static void +launch_search (EphySearchProvider *self, + char **terms, + guint timestamp) +{ + char *search_string, *url_search, *query_param, *effective_url; + + url_search = g_settings_get_string (self->settings, EPHY_PREFS_KEYWORD_SEARCH_URL); + + if (url_search == NULL || url_search[0] == '\0') { + g_free (url_search); + + url_search = g_strdup (_("http://duckduckgo.com/?q=%s&t=epiphany")); + } + + search_string = g_strjoinv (" ", terms); + query_param = soup_form_encode ("q", search_string, NULL); + /* + 2 here is getting rid of 'q=' */ + effective_url = g_strdup_printf (url_search, query_param + 2); + + launch_uri (effective_url, timestamp); + + g_free (query_param); + g_free (url_search); + g_free (effective_url); + g_free (search_string); +} + +static gboolean +handle_activate_result (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char *identifier, + char **terms, + guint timestamp, + EphySearchProvider *self) +{ + g_application_hold (G_APPLICATION (ephy_shell_get_default ())); + g_cancellable_cancel (self->cancellable); + + if (strcmp (identifier, "special:search") == 0) + launch_search (self, terms, timestamp); + else + launch_uri (identifier, timestamp); + + ephy_shell_search_provider2_complete_activate_result (skeleton, invocation); + g_application_release (G_APPLICATION (ephy_shell_get_default ())); + + return TRUE; +} + +static gboolean +handle_launch_search (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **terms, + guint timestamp, + EphySearchProvider *self) +{ + g_application_hold (G_APPLICATION (ephy_shell_get_default ())); + g_cancellable_cancel (self->cancellable); + + launch_search (self, terms, timestamp); + + ephy_shell_search_provider2_complete_launch_search (skeleton, invocation); + g_application_release (G_APPLICATION (ephy_shell_get_default ())); + + return TRUE; +} + +static void +ephy_search_provider_init (EphySearchProvider *self) +{ + self->skeleton = ephy_shell_search_provider2_skeleton_new (); + + g_signal_connect (self->skeleton, "handle-get-initial-result-set", + G_CALLBACK (handle_get_initial_result_set), self); + g_signal_connect (self->skeleton, "handle-get-subsearch-result-set", + G_CALLBACK (handle_get_subsearch_result_set), self); + g_signal_connect (self->skeleton, "handle-get-result-metas", + G_CALLBACK (handle_get_result_metas), self); + g_signal_connect (self->skeleton, "handle-activate-result", + G_CALLBACK (handle_activate_result), self); + g_signal_connect (self->skeleton, "handle-launch-search", + G_CALLBACK (handle_launch_search), self); + + self->settings = g_settings_new (EPHY_PREFS_SCHEMA); + + self->model = ephy_completion_model_new (); + self->cancellable = g_cancellable_new (); +} + +gboolean +ephy_search_provider_dbus_register (EphySearchProvider *self, + GDBusConnection *connection, + const gchar *object_path, + GError **error) +{ + GDBusInterfaceSkeleton *skeleton; + + skeleton = G_DBUS_INTERFACE_SKELETON (self->skeleton); + + return g_dbus_interface_skeleton_export (skeleton, connection, object_path, error); +} + +void +ephy_search_provider_dbus_unregister (EphySearchProvider *self, + GDBusConnection *connection, + const gchar *object_path) +{ + GDBusInterfaceSkeleton *skeleton; + + skeleton = G_DBUS_INTERFACE_SKELETON (self->skeleton); + + if (g_dbus_interface_skeleton_has_connection (skeleton, connection)) + g_dbus_interface_skeleton_unexport_from_connection (skeleton, connection); +} + +static void +ephy_search_provider_dispose (GObject *object) +{ + EphySearchProvider *self; + + self = EPHY_SEARCH_PROVIDER (object); + + g_clear_object (&self->skeleton); + g_clear_object (&self->settings); + g_clear_object (&self->cancellable); + g_clear_object (&self->model); + + G_OBJECT_CLASS (ephy_search_provider_parent_class)->dispose (object); +} + +static void +ephy_search_provider_class_init (EphySearchProviderClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = ephy_search_provider_dispose; +} + +EphySearchProvider * +ephy_search_provider_new (void) +{ + return g_object_new (EPHY_TYPE_SEARCH_PROVIDER, NULL); +} + diff --git a/src/ephy-search-provider.h b/src/ephy-search-provider.h new file mode 100644 index 000000000..5ad7d9259 --- /dev/null +++ b/src/ephy-search-provider.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2013 Giovanni Campagna <scampa.giovanni@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the Control Center; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef _EPHY_SEARCH_PROVIDER_H +#define _EPHY_SEARCH_PROVIDER_H + +#include "ephy-shell-search-provider-generated.h" + +#include <glib-object.h> +#include <gio/gio.h> + +G_BEGIN_DECLS + +#define EPHY_TYPE_SEARCH_PROVIDER (ephy_search_provider_get_type ()) + +#define EPHY_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_SEARCH_PROVIDER, EphySearchProvider)) +#define EPHY_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_SEARCH_PROVIDER, EphySearchProviderClass)) +#define EPHY_IS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_SEARCH_PROVIDER)) +#define EPHY_IS_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_TYPE_SEARCH_PROVIDER)) +#define EPHY_SEARCH_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_TYPE_SEARCH_PROVIDER, EphySearchProviderClass)) + +typedef struct _EphySearchProvider EphySearchProvider; +typedef struct _EphySearchProviderClass EphySearchProviderClass; + +GType ephy_search_provider_get_type (void) G_GNUC_CONST; + +EphySearchProvider *ephy_search_provider_new (void); + +gboolean ephy_search_provider_dbus_register (EphySearchProvider *provider, + GDBusConnection *connection, + const char *object_path, + GError **error); +void ephy_search_provider_dbus_unregister (EphySearchProvider *provider, + GDBusConnection *connection, + const char *object_path); + +G_END_DECLS + +#endif /* _EPHY_SEARCH_PROVIDER_H */ diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 9e91bc7b0..f4c9b707d 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -35,6 +35,7 @@ #include "ephy-lockdown.h" #include "ephy-prefs.h" #include "ephy-private.h" +#include "ephy-search-provider.h" #include "ephy-session.h" #include "ephy-settings.h" #include "ephy-type-builtins.h" @@ -53,6 +54,7 @@ #define EPHY_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHELL, EphyShellPrivate)) struct _EphyShellPrivate { + EphySearchProvider *search_provider; EphySession *session; GList *windows; GObject *lockdown; @@ -519,6 +521,42 @@ ephy_shell_constructed (GObject *object) G_OBJECT_CLASS (ephy_shell_parent_class)->constructed (object); } +static gboolean +ephy_shell_dbus_register (GApplication *application, + GDBusConnection *connection, + const gchar *object_path, + GError **error) +{ + EphyShell *self; + + if (!G_APPLICATION_CLASS (ephy_shell_parent_class)->dbus_register (application, + connection, + object_path, + error)) + return FALSE; + + self = EPHY_SHELL (application); + + return ephy_search_provider_dbus_register (self->priv->search_provider, connection, + object_path, error); +} + +static void +ephy_shell_dbus_unregister (GApplication *application, + GDBusConnection *connection, + const gchar *object_path) +{ + EphyShell *self; + + self = EPHY_SHELL (application); + if (self->priv->search_provider) + ephy_search_provider_dbus_unregister (self->priv->search_provider, connection, object_path); + + G_APPLICATION_CLASS (ephy_shell_parent_class)->dbus_unregister (application, + connection, + object_path); +} + static void ephy_shell_class_init (EphyShellClass *klass) { @@ -533,6 +571,8 @@ ephy_shell_class_init (EphyShellClass *klass) application_class->activate = ephy_shell_activate; application_class->before_emit = ephy_shell_before_emit; application_class->add_platform_data = ephy_shell_add_platform_data; + application_class->dbus_register = ephy_shell_dbus_register; + application_class->dbus_unregister = ephy_shell_dbus_unregister; g_type_class_add_private (object_class, sizeof(EphyShellPrivate)); } @@ -615,6 +655,8 @@ ephy_shell_init (EphyShell *shell) g_free (favicon_db_path); #endif + shell->priv->search_provider = ephy_search_provider_new (); + g_application_set_inactivity_timeout (G_APPLICATION (shell), 60 * 1000); } @@ -625,6 +667,7 @@ ephy_shell_dispose (GObject *object) LOG ("EphyShell disposing"); + g_clear_object (&priv->search_provider); g_clear_object (&priv->session); g_clear_object (&priv->lockdown); g_clear_pointer (&priv->bme, gtk_widget_destroy); diff --git a/src/org.gnome.ShellSearchProvider2.xml b/src/org.gnome.ShellSearchProvider2.xml new file mode 100644 index 000000000..26b213d57 --- /dev/null +++ b/src/org.gnome.ShellSearchProvider2.xml @@ -0,0 +1,87 @@ +<!DOCTYPE node PUBLIC +'-//freedesktop//DTD D-BUS Object Introspection 1.0//EN' +'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'> +<node> + + <!-- + org.gnome.Shell.SearchProvider2: + @short_description: Search provider interface + + The interface used for integrating into GNOME Shell's search + interface (version 2). + --> + <interface name="org.gnome.Shell.SearchProvider2"> + + <!-- + GetInitialResultSet: + @terms: Array of search terms, which the provider should treat as logical AND. + @results: An array of result identifier strings representing items which match the given search terms. Identifiers must be unique within the provider's domain, but other than that may be chosen freely by the provider. + + Called when the user first begins a search. + --> + <method name="GetInitialResultSet"> + <arg type="as" name="terms" direction="in" /> + <arg type="as" name="results" direction="out" /> + </method> + + <!-- + GetSubsearchResultSet: + @previous_results: Array of results previously returned by GetInitialResultSet(). + @terms: Array of updated search terms, which the provider should treat as logical AND. + @results: An array of result identifier strings representing items which match the given search terms. Identifiers must be unique within the provider's domain, but other than that may be chosen freely by the provider. + + Called when a search is performed which is a "subsearch" of + the previous search, e.g. the method may return less results, but + not more or different results. + + This allows search providers to only search through the previous + result set, rather than possibly performing a full re-query. + --> + <method name="GetSubsearchResultSet"> + <arg type="as" name="previous_results" direction="in" /> + <arg type="as" name="terms" direction="in" /> + <arg type="as" name="results" direction="out" /> + </method> + + <!-- + GetResultMetas: + @identifiers: An array of result identifiers as returned by GetInitialResultSet() or GetSubsearchResultSet() + @metas: A dictionary describing the given search result, containing 'id' and 'name' (both strings). Optionally, either 'gicon' (a serialized GIcon) or 'icon-data' (raw image data as (iiibiiay) - width, height, rowstride, has-alpha, bits per sample, channels, data) can be specified if the result can be better served with a thumbnail of the content (such as with images). A 'description' field (string) may also be specified if more context would help the user find the desired result. + + Return an array of meta data used to display each given result + --> + <method name="GetResultMetas"> + <arg type="as" name="identifiers" direction="in" /> + <arg type="aa{sv}" name="metas" direction="out" /> + </method> + + <!-- + ActivateResult: + @identifier: A result identifier as returned by GetInitialResultSet() or GetSubsearchResultSet() + @terms: Array of search terms, which the provider should treat as logical AND. + @timestamp: A timestamp of the user interaction that triggered this call + + Called when the users chooses a given result. The result should + be displayed in the application associated with the corresponding + provider. The provided search terms can be used to allow launching a full search in + the application. + --> + <method name="ActivateResult"> + <arg type="s" name="identifier" direction="in" /> + <arg type="as" name="terms" direction="in" /> + <arg type="u" name="timestamp" direction="in" /> + </method> + + <!-- + LaunchSearch: + @terms: Array of search terms, which the provider should treat as logical AND. + @timestamp: A timestamp of the user interaction that triggered this call + + Asks the search provider to launch a full search in the application for the provided terms. + --> + <method name="LaunchSearch"> + <arg type="as" name="terms" direction="in" /> + <arg type="u" name="timestamp" direction="in" /> + </method> + </interface> +</node> |