diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | embed/ephy-embed-single.c | 22 | ||||
-rw-r--r-- | embed/ephy-embed-single.h | 9 | ||||
-rw-r--r-- | embed/mozilla/EphySidebar.cpp | 35 | ||||
-rw-r--r-- | lib/ephy-marshal.list | 1 |
5 files changed, 62 insertions, 14 deletions
@@ -1,3 +1,12 @@ +2005-02-14 Christian Persch <chpe@cvs.gnome.org> + + * embed/ephy-embed-single.c: (ephy_embed_single_iface_init): + * embed/ephy-embed-single.h: + * embed/mozilla/EphySidebar.cpp: + * lib/ephy-marshal.list: + + Emit a signal in EphySidebar::AddSearchEngine. + 2005-02-13 Christian Persch <chpe@cvs.gnome.org> * lib/egg/eggstatusicon.c: (egg_status_icon_init), diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c index 0b05dc876..c2138a189 100644 --- a/embed/ephy-embed-single.c +++ b/embed/ephy-embed-single.c @@ -141,6 +141,28 @@ ephy_embed_single_iface_init (gpointer g_class) G_TYPE_STRING); /** + * EphyEmbedSingle::add-search-engine + * @single: + * @url: The url of the search engine definition file + * @icon_url: The url of the icon to use for this engine + * @title: The title of the search engine to be added + * + * The ::add-search-engine signal is emitted when the user clicks a javascript link that + * requests adding a search engine to the sidebar. + **/ + g_signal_new ("add-search-engine", + EPHY_TYPE_EMBED_SINGLE, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EphyEmbedSingleIface, add_search_engine), + g_signal_accumulator_true_handled, NULL, + ephy_marshal_BOOLEAN__STRING_STRING_STRING, + G_TYPE_BOOLEAN, + 3, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING); + +/** * EphyEmbedSingle::check_content: * @single: the #EphyEmbedSingle * @type: the type of content (an #EphyContentCheckType) diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h index 03e4f9a05..63d065666 100644 --- a/embed/ephy-embed-single.h +++ b/embed/ephy-embed-single.h @@ -66,8 +66,13 @@ struct _EphyEmbedSingleIface gboolean (* add_sidebar) (EphyEmbedSingle *single, - const char * url, - const char * title); + const char *url, + const char *title); + + gboolean (* add_search_engine) (EphyEmbedSingle *single, + const char *url, + const char *icon_url, + const char *title); gboolean (* check_content) (EphyEmbedSingle *single, EphyContentCheckType type, diff --git a/embed/mozilla/EphySidebar.cpp b/embed/mozilla/EphySidebar.cpp index ff98e29e6..953f8561c 100644 --- a/embed/mozilla/EphySidebar.cpp +++ b/embed/mozilla/EphySidebar.cpp @@ -47,12 +47,11 @@ EphySidebar::~EphySidebar() { } - /* void addPanel (in wstring aTitle, in string aContentURL, in string aCustomizeURL); */ NS_IMETHODIMP EphySidebar::AddPanel (const PRUnichar *aTitle, - const char *aContentURL, - const char *aCustomizeURL) + const char *aContentURL, + const char *aCustomizeURL) { nsEmbedCString title; EphyEmbedSingle *single; @@ -74,24 +73,36 @@ EphySidebar::AddPanel (const PRUnichar *aTitle, /* void addPersistentPanel (in wstring aTitle, in string aContentURL, in string aCustomizeURL); */ NS_IMETHODIMP EphySidebar::AddPersistentPanel (const PRUnichar *aTitle, - const char *aContentURL, - const char *aCustomizeURL) + const char *aContentURL, + const char *aCustomizeURL) { - return NS_ERROR_NOT_IMPLEMENTED; + return AddPanel (aTitle, aContentURL, aCustomizeURL); } /* void addSearchEngine (in string engineURL, in string iconURL, in wstring suggestedTitle, in wst ring suggestedCategory); */ NS_IMETHODIMP -EphySidebar::AddSearchEngine (const char *engineURL, - const char *iconURL, - const PRUnichar *suggestedTitle, - const PRUnichar *suggestedCategory) +EphySidebar::AddSearchEngine (const char *aEngineURL, + const char *aIconURL, + const PRUnichar *aSuggestedTitle, + const PRUnichar *aSuggestedCategory) { - return NS_ERROR_NOT_IMPLEMENTED; -} + nsEmbedCString title; + EphyEmbedSingle *single; + + NS_UTF16ToCString (nsEmbedString(aSuggestedTitle), + NS_CSTRING_ENCODING_UTF8, title); + LOG ("Adding search engine, engineurl=%s iconurl=%s title=%s", aEngineURL, aIconURL, title.get()); + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); + + gboolean result = FALSE; + g_signal_emit_by_name (single, "add-search-engine", + aEngineURL, aIconURL, title.get(), &result); + + return NS_OK; +} //------------------------------------------------------------------------------ //nsIClassInfo Impl. diff --git a/lib/ephy-marshal.list b/lib/ephy-marshal.list index 9d4efc5b9..762481266 100644 --- a/lib/ephy-marshal.list +++ b/lib/ephy-marshal.list @@ -1,6 +1,7 @@ BOOLEAN:ENUM,STRING,STRING,STRING BOOLEAN:OBJECT BOOLEAN:STRING,STRING +BOOLEAN:STRING,STRING,STRING BOOLEAN:VOID OBJECT:OBJECT,FLAGS OBJECT:STRING,OBJECT,FLAGS |