aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-02-15 04:57:08 +0800
committerChristian Persch <chpe@src.gnome.org>2005-02-15 04:57:08 +0800
commitef7614362de89dbf7ebcfbe18bc1284754f17164 (patch)
tree141cefc47787ba88f82d871d0eaf3dc2fb0631f1
parent8393fcfb76309e11471481c922b9fc4ce666fdc9 (diff)
downloadgsoc2013-epiphany-ef7614362de89dbf7ebcfbe18bc1284754f17164.tar
gsoc2013-epiphany-ef7614362de89dbf7ebcfbe18bc1284754f17164.tar.gz
gsoc2013-epiphany-ef7614362de89dbf7ebcfbe18bc1284754f17164.tar.bz2
gsoc2013-epiphany-ef7614362de89dbf7ebcfbe18bc1284754f17164.tar.lz
gsoc2013-epiphany-ef7614362de89dbf7ebcfbe18bc1284754f17164.tar.xz
gsoc2013-epiphany-ef7614362de89dbf7ebcfbe18bc1284754f17164.tar.zst
gsoc2013-epiphany-ef7614362de89dbf7ebcfbe18bc1284754f17164.zip
Emit a signal in EphySidebar::AddSearchEngine.
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.
-rw-r--r--ChangeLog9
-rw-r--r--embed/ephy-embed-single.c22
-rw-r--r--embed/ephy-embed-single.h9
-rw-r--r--embed/mozilla/EphySidebar.cpp35
-rw-r--r--lib/ephy-marshal.list1
5 files changed, 62 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 1fbfc00f7..411c1884c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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