[gnome-photos/wip/search: 2/27] Add PhotosSearchProvider



commit fe9bdb7fbb3f561e99a28634e7ac98d4f35861ad
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Dec 5 11:12:07 2013 +0100

    Add PhotosSearchProvider

 src/Makefile.am                        |   10 ++++
 src/org.gnome.ShellSearchProvider2.xml |   87 ++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 3c6dd9b..43ed1e9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,6 +22,8 @@ gnome_photos_built_sources = \
        photos-mpris-player.h \
        photos-resources.c \
        photos-resources.h \
+       photos-shell-search-provider2.c \
+       photos-shell-search-provider2.h \
        photos-tracker-resources.c \
        photos-tracker-resources.h \
        $(NULL)
@@ -207,6 +209,7 @@ BUILT_SOURCES = \
 
 EXTRA_DIST = \
        gegl-gtk-marshal.list \
+       org.gnome.ShellSearchProvider2.xml \
        photos-enums.c.template \
        photos-enums.h.template \
        photos-generate-about \
@@ -446,6 +449,13 @@ photos-mpris-player.h photos-mpris-player.c: photos-mpris-player.xml
                --interface-prefix org.mpris.MediaPlayer2. \
                $<
 
+photos-shell-search-provider2.h photos-shell-search-provider2.c: org.gnome.ShellSearchProvider2.xml Makefile
+       $(AM_V_GEN)gdbus-codegen \
+               --c-namespace Shell \
+               --generate-c-code photos-shell-search-provider2 \
+               --interface-prefix org.gnome.Shell. \
+               $<
+
 photos-tracker-resources.h photos-tracker-resources.c: photos-tracker-resources.xml
        $(AM_V_GEN)gdbus-codegen \
                --c-namespace Tracker \
diff --git a/src/org.gnome.ShellSearchProvider2.xml b/src/org.gnome.ShellSearchProvider2.xml
new file mode 100644
index 0000000..9502340
--- /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 a human-readable 'name' 
(string), along with the result identifier this meta is for, 'id' (string). Optionally, 'icon' (a serialized 
GIcon as obtained by g_icon_serialize) can be specified if the result can be better served with a thumbnail 
of the content (such as with images). 'gicon' (a serialized GIcon as obtained by g_icon_to_string) or 
'icon-data' (raw image data as (iiibiiay) - width, height, rowstride, has-alpha, bits per sample, channels, 
data) are deprecated values that can also be used for that purpose. 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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]