Google backend
- From: Don Smith <donsmith77 hotpop com>
- To: "dashboard-hackers gnome org" <dashboard-hackers gnome org>
- Subject: Google backend
- Date: Mon, 16 Feb 2004 15:45:47 -0500
I fixed the google backend to work with the new dashboard Matches, the
patch is attached. also I have a problem in that any time I click on any
link in dashboard dashboard crashes.
Don
? google.patch
? util/webservices/GoogleSearchService.cs
? util/webservices/GoogleSearchService.dll
Index: backends/GoogleBackend.cs
===================================================================
RCS file: /cvs/gnome/dashboard/backends/GoogleBackend.cs,v
retrieving revision 1.4
diff -u -r1.4 GoogleBackend.cs
--- backends/GoogleBackend.cs 14 Feb 2004 05:50:34 -0000 1.4
+++ backends/GoogleBackend.cs 16 Feb 2004 20:39:24 -0000
@@ -18,13 +18,13 @@
// Set your key below. You can get a Google API key
// at http://www.google.com/apis/.
- int google_api_key="";
+ string google_api_key="INSERT DEVTAG HERE";
public override bool Startup ()
{
Name = "Google";
- if (google_api_key.Length == 0)
+ if (google_api_key == "INSERT DEVTAG HERE")
return false;
try {
@@ -43,7 +43,7 @@
{
int max_results=10;
- string dev_key="INSERT DEV TAG HERE";
+ string dev_key=google_api_key;
int start_result=0;
bool dupe_filter=true;
bool safe_search=true;
@@ -72,19 +72,18 @@
}
for (int i = 0; i < max_results; i++) {
- BackendResult GoogleResult = new BackendResult();
- GoogleResult.AddItem (new BackendResultItem ("GoogleResult",
- gsr.resultElements[i].title,
- "text",
- "html",
- gsr.resultElements[i].URL ));
- results.Add(GoogleResult);
+ Match GoogleMatch = new Match("WebLink", clue);
+ GoogleMatch ["title"] = gsr.resultElements[i].title;
+ GoogleMatch ["url"] = gsr.resultElements[i].URL;
+ GoogleMatch ["icon"] = "internal:bookmark.png";
+ results.Add(GoogleMatch);
}
if (results.Count > 0)
return results;
else
return null;
+
}
}
}
Index: backends/Makefile.am
===================================================================
RCS file: /cvs/gnome/dashboard/backends/Makefile.am,v
retrieving revision 1.63
diff -u -r1.63 Makefile.am
--- backends/Makefile.am 16 Feb 2004 09:21:22 -0000 1.63
+++ backends/Makefile.am 16 Feb 2004 20:39:24 -0000
@@ -11,6 +11,7 @@
EvolutionMailBackend.dll \
GaimLogBackend.dll \
GaleonBookmarksBackend.dll \
+ GoogleBackend.dll \
GeoSitesBackend.dll \
ManPagesBackend.dll \
MozillaBookmarksBackend.dll \
@@ -29,7 +30,6 @@
FoafFileBackend.dll \
DocumentIndexBackend.dll \
EvolutionAddressbookBackend.dll \
- GoogleBackend.dll \
HTTPBridgeBackend.dll \
RhythmboxLibraryBackend.dll \
RegexpChainerBackend.dll \
@@ -85,6 +85,9 @@
EvolutionMailBackend.dll: EvolutionMailBackend.cs $(dashboard_exe)
$(CSC) $(LIBFLAGS) -out:EvolutionMailBackend.dll $(srcdir)/EvolutionMailBackend.cs -r:../util/evolution/evolution.dll -r:gconf-sharp
+GoogleBackend.dll: GoogleBackend.cs $(dashboard_exe)
+ $(CSC) $(LIBFLAGS) -out:GoogleBackend.dll $(srcdir)/GoogleBackend.cs -r:../util/webservices/GoogleSearchService.dll
+
RhythmboxLibraryBackend: backend-rhythmboxlibrary.cs $(dashboard_exe)
$(CSC) $(LIBFLAGS) -out:backend-rhythmboxlibrary.dll $(srcdir)/backend-rhythmboxlibrary.cs -r:../util/webservices/AmazonSearchService.dll
Index: util/webservices/GoogleSearch.wsdl
===================================================================
RCS file: util/webservices/GoogleSearch.wsdl
diff -N util/webservices/GoogleSearch.wsdl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ util/webservices/GoogleSearch.wsdl 16 Feb 2004 20:39:24 -0000
@@ -0,0 +1,198 @@
+<?xml version="1.0"?>
+
+<!-- WSDL description of the Google Web APIs.
+ The Google Web APIs are in beta release. All interfaces are subject to
+ change as we refine and extend our APIs. Please see the terms of use
+ for more information. -->
+
+<!-- Revision 2002-08-16 -->
+
+<definitions name="GoogleSearch"
+ targetNamespace="urn:GoogleSearch"
+ xmlns:typens="urn:GoogleSearch"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <!-- Types for search - result elements, directory categories -->
+
+ <types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:GoogleSearch">
+
+ <xsd:complexType name="GoogleSearchResult">
+ <xsd:all>
+ <xsd:element name="documentFiltering" type="xsd:boolean"/>
+ <xsd:element name="searchComments" type="xsd:string"/>
+ <xsd:element name="estimatedTotalResultsCount" type="xsd:int"/>
+ <xsd:element name="estimateIsExact" type="xsd:boolean"/>
+ <xsd:element name="resultElements" type="typens:ResultElementArray"/>
+ <xsd:element name="searchQuery" type="xsd:string"/>
+ <xsd:element name="startIndex" type="xsd:int"/>
+ <xsd:element name="endIndex" type="xsd:int"/>
+ <xsd:element name="searchTips" type="xsd:string"/>
+ <xsd:element name="directoryCategories" type="typens:DirectoryCategoryArray"/>
+ <xsd:element name="searchTime" type="xsd:double"/>
+ </xsd:all>
+ </xsd:complexType>
+
+ <xsd:complexType name="ResultElement">
+ <xsd:all>
+ <xsd:element name="summary" type="xsd:string"/>
+ <xsd:element name="URL" type="xsd:string"/>
+ <xsd:element name="snippet" type="xsd:string"/>
+ <xsd:element name="title" type="xsd:string"/>
+ <xsd:element name="cachedSize" type="xsd:string"/>
+ <xsd:element name="relatedInformationPresent" type="xsd:boolean"/>
+ <xsd:element name="hostName" type="xsd:string"/>
+ <xsd:element name="directoryCategory" type="typens:DirectoryCategory"/>
+ <xsd:element name="directoryTitle" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+
+ <xsd:complexType name="ResultElementArray">
+ <xsd:complexContent>
+ <xsd:restriction base="soapenc:Array">
+ <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:ResultElement[]"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="DirectoryCategoryArray">
+ <xsd:complexContent>
+ <xsd:restriction base="soapenc:Array">
+ <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:DirectoryCategory[]"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="DirectoryCategory">
+ <xsd:all>
+ <xsd:element name="fullViewableName" type="xsd:string"/>
+ <xsd:element name="specialEncoding" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </types>
+
+ <!-- Messages for Google Web APIs - cached page, search, spelling. -->
+
+ <message name="doGetCachedPage">
+ <part name="key" type="xsd:string"/>
+ <part name="url" type="xsd:string"/>
+ </message>
+
+ <message name="doGetCachedPageResponse">
+ <part name="return" type="xsd:base64Binary"/>
+ </message>
+
+ <message name="doSpellingSuggestion">
+ <part name="key" type="xsd:string"/>
+ <part name="phrase" type="xsd:string"/>
+ </message>
+
+ <message name="doSpellingSuggestionResponse">
+ <part name="return" type="xsd:string"/>
+ </message>
+
+ <!-- note, ie and oe are ignored by server; all traffic is UTF-8. -->
+
+ <message name="doGoogleSearch">
+ <part name="key" type="xsd:string"/>
+ <part name="q" type="xsd:string"/>
+ <part name="start" type="xsd:int"/>
+ <part name="maxResults" type="xsd:int"/>
+ <part name="filter" type="xsd:boolean"/>
+ <part name="restrict" type="xsd:string"/>
+ <part name="safeSearch" type="xsd:boolean"/>
+ <part name="lr" type="xsd:string"/>
+ <part name="ie" type="xsd:string"/>
+ <part name="oe" type="xsd:string"/>
+ </message>
+
+ <message name="doGoogleSearchResponse">
+ <part name="return" type="typens:GoogleSearchResult"/>
+ </message>
+
+ <!-- Port for Google Web APIs, "GoogleSearch" -->
+
+ <portType name="GoogleSearchPort">
+
+ <operation name="doGetCachedPage">
+ <input message="typens:doGetCachedPage"/>
+ <output message="typens:doGetCachedPageResponse"/>
+ </operation>
+
+ <operation name="doSpellingSuggestion">
+ <input message="typens:doSpellingSuggestion"/>
+ <output message="typens:doSpellingSuggestionResponse"/>
+ </operation>
+
+ <operation name="doGoogleSearch">
+ <input message="typens:doGoogleSearch"/>
+ <output message="typens:doGoogleSearchResponse"/>
+ </operation>
+
+ </portType>
+
+
+ <!-- Binding for Google Web APIs - RPC, SOAP over HTTP -->
+
+ <binding name="GoogleSearchBinding" type="typens:GoogleSearchPort">
+ <soap:binding style="rpc"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <operation name="doGetCachedPage">
+ <soap:operation soapAction="urn:GoogleSearchAction"/>
+ <input>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="doSpellingSuggestion">
+ <soap:operation soapAction="urn:GoogleSearchAction"/>
+ <input>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="doGoogleSearch">
+ <soap:operation soapAction="urn:GoogleSearchAction"/>
+ <input>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+ </binding>
+
+ <!-- Endpoint for Google Web APIs -->
+ <service name="GoogleSearchService">
+ <port name="GoogleSearchPort" binding="typens:GoogleSearchBinding">
+ <soap:address location="http://api.google.com/search/beta2"/>
+ </port>
+ </service>
+
+</definitions>
Index: util/webservices/Makefile.am
===================================================================
RCS file: /cvs/gnome/dashboard/util/webservices/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- util/webservices/Makefile.am 14 Feb 2004 06:20:08 -0000 1.2
+++ util/webservices/Makefile.am 16 Feb 2004 20:39:24 -0000
@@ -2,16 +2,23 @@
LIBFLAGS=-target:library -r:System.Web.Services
DLL = \
- AmazonSearchService.dll
+ AmazonSearchService.dll \
+ GoogleSearchService.dll
all: $(DLL)
AmazonSearchService.cs: AmazonSearchService.wsdl
wsdl AmazonSearchService.wsdl
+GoogleSearchService.cs: GoogleSearch.wsdl
+ wsdl GoogleSearch.wsdl
+
AmazonSearchService.dll: AmazonSearchService.cs
$(CSC) $(LIBFLAGS) -out:AmazonSearchService.dll $(srcdir)/AmazonSearchService.cs
+GoogleSearchService.dll: GoogleSearchService.cs
+ $(CSC) $(LIBFLAGS) -out:GoogleSearchService.dll $(srcdir)/GoogleSearchService.cs
+
dashboardlibdir = $(prefix)/lib/dashboard
install-data-local: $(DLL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]