diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-09 03:12:33 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-09 03:12:33 +0800 |
commit | 74f30634c4d7187f9c04b0b4e7dfad1253c5616c (patch) | |
tree | bb5e9c11ecc10e6af05addc7b519e69f9386aa86 | |
parent | 5df83cc343c496873f84e939a6367b69ad9286bb (diff) | |
download | gsoc2013-epiphany-74f30634c4d7187f9c04b0b4e7dfad1253c5616c.tar gsoc2013-epiphany-74f30634c4d7187f9c04b0b4e7dfad1253c5616c.tar.gz gsoc2013-epiphany-74f30634c4d7187f9c04b0b4e7dfad1253c5616c.tar.bz2 gsoc2013-epiphany-74f30634c4d7187f9c04b0b4e7dfad1253c5616c.tar.lz gsoc2013-epiphany-74f30634c4d7187f9c04b0b4e7dfad1253c5616c.tar.xz gsoc2013-epiphany-74f30634c4d7187f9c04b0b4e7dfad1253c5616c.tar.zst gsoc2013-epiphany-74f30634c4d7187f9c04b0b4e7dfad1253c5616c.zip |
More start here page work, importing bookmarks from mozilla now should
2003-01-08 Marco Pesenti Gritti <marco@it.gnome.org>
* TODO:
* data/starthere/Makefile.am:
* data/starthere/index.xml.in:
* data/starthere/section.xsl:
* data/starthere/smartbookmarks.xml.in:
* embed/ephy-embed-shell.c: (ephy_embed_shell_class_init):
* embed/ephy-embed-shell.h:
* embed/mozilla/StartHereProtocolHandler.cpp:
* po/POTFILES.in:
* src/ephy-shell.c: (ephy_shell_command_cb), (ephy_shell_init):
More start here page work, importing bookmarks from mozilla
now should work.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | data/starthere/Makefile.am | 2 | ||||
-rw-r--r-- | data/starthere/index.xml.in | 6 | ||||
-rw-r--r-- | data/starthere/section.xsl | 8 | ||||
-rw-r--r-- | data/starthere/smartbookmarks.xml.in | 28 | ||||
-rw-r--r-- | embed/ephy-embed-shell.c | 12 | ||||
-rw-r--r-- | embed/ephy-embed-shell.h | 4 | ||||
-rw-r--r-- | embed/mozilla/StartHereProtocolHandler.cpp | 19 | ||||
-rw-r--r-- | po/POTFILES.in | 3 | ||||
-rw-r--r-- | src/ephy-shell.c | 39 |
11 files changed, 134 insertions, 5 deletions
@@ -1,3 +1,19 @@ +2003-01-08 Marco Pesenti Gritti <marco@it.gnome.org> + + * TODO: + * data/starthere/Makefile.am: + * data/starthere/index.xml.in: + * data/starthere/section.xsl: + * data/starthere/smartbookmarks.xml.in: + * embed/ephy-embed-shell.c: (ephy_embed_shell_class_init): + * embed/ephy-embed-shell.h: + * embed/mozilla/StartHereProtocolHandler.cpp: + * po/POTFILES.in: + * src/ephy-shell.c: (ephy_shell_command_cb), (ephy_shell_init): + + More start here page work, importing bookmarks from mozilla + now should work. + 2003-01-07 Marco Pesenti Gritti <marco@it.gnome.org> * data/starthere/Makefile.am: @@ -4,6 +4,8 @@ To do: - loading feedback on tabs - create print preview toolbar only when necessary - embed dialogs crashes when the window has been closed +- save bookmarks dialog state (current keyword) +- show bookmarks updated content Done: diff --git a/data/starthere/Makefile.am b/data/starthere/Makefile.am index 77b723f8b..1cdf7815f 100644 --- a/data/starthere/Makefile.am +++ b/data/starthere/Makefile.am @@ -1,7 +1,7 @@ @INTLTOOL_XML_RULE@ xmldir = $(pkgdatadir)/starthere -xml_in_files = index.xml.in +xml_in_files = index.xml.in smartbookmarks.xml.in xml_DATA = $(xml_in_files:.xml.in=.xml) pagedir = $(pkgdatadir)/starthere diff --git a/data/starthere/index.xml.in b/data/starthere/index.xml.in index dd8a0f9a8..7427ab1ee 100644 --- a/data/starthere/index.xml.in +++ b/data/starthere/index.xml.in @@ -8,7 +8,9 @@ <_title>The web browser</_title> <_paragraph> You can start browsing web pages either by typing a location (example: www.google.com) -or a keyword (example: best computer shop) in the toolbar text entry. +or a keyword (example: best computer shop) in the toolbar text entry and then pressing +the Enter key. You can remember important visited pages using bookmarks or browse all of +them with the history dialog. </_paragraph> <_title>Getting started</_title> <_paragraph> @@ -18,6 +20,6 @@ click on one of the links below: </_paragraph> <_paragraph> If your internet connection requires it, make sure to setup your proxy in the -desktop wide <_action>configuration dialog</_action>. +desktop wide <action id="configure-network" param="">configuration dialog</action>. </_paragraph> </section> diff --git a/data/starthere/section.xsl b/data/starthere/section.xsl index 62bdcf598..fb19cded3 100644 --- a/data/starthere/section.xsl +++ b/data/starthere/section.xsl @@ -55,10 +55,16 @@ </xsl:template> <xsl:template match="action"> -<a href="action:{@id}?{@param}"> +<a href="start-here:{@id}?{@param}"> <xsl:apply-templates/> </a> </xsl:template> +<xsl:template match="smartbookmark"> +<a type="text/smartbookmark" href="{@normal}" rel="{@smart}" title="{@title}"> + <xsl:apply-templates/> +</a><br/> +</xsl:template> + </xsl:stylesheet> diff --git a/data/starthere/smartbookmarks.xml.in b/data/starthere/smartbookmarks.xml.in new file mode 100644 index 000000000..7eed310eb --- /dev/null +++ b/data/starthere/smartbookmarks.xml.in @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/xsl" href="section.xsl"?> +<section> +<bar> +<item section="start-here:">Start Here</item> +<item section="start-here:smartbookmarks">Smart Bookmarks</item> +</bar> +<content> +<_title>Smart Bookmarks</_title> +<_paragraph> +Smart bookmarks allows to perform searches and similar actions directly from +the location entry. +</_paragraph> +<_paragraph> +Right click the icon and choose "Add Bookmark" from the menu list. +When you will type a word in the toolbar entry, a list of your smart +bookmarks will be displayed. Just choose one of them to perform the search. +The next time you type a word, just pressing the Enter key will be enough to +perform the same action. +</_paragraph> +<smartbookmark normal="http://www.google.com/" smart="http://www.google.com/search?q=%s" title="Search the web - Google"> +Search the web - Google +</smartbookmark> +<smartbookmark normal="http://images.google.com/" smart="http://images.google.com/images?q=%s" title="Search images - Google"> +Search images - Google +</smartbookmark> +</content> +</section> diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index 69d1c98dd..679e6f663 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -29,6 +29,7 @@ enum { NEW_WINDOW, + COMMAND, LAST_SIGNAL }; @@ -113,6 +114,17 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass) 2, G_TYPE_POINTER, G_TYPE_INT); + ephy_embed_shell_signals[COMMAND] = + g_signal_new ("command", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EphyEmbedShellClass, command), + NULL, NULL, + ephy_marshal_VOID__STRING_STRING, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_TYPE_STRING); } static void diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h index 105db27f2..e7d789d57 100644 --- a/embed/ephy-embed-shell.h +++ b/embed/ephy-embed-shell.h @@ -139,6 +139,10 @@ struct EphyEmbedShellClass EphyEmbed **new_embed, EmbedChromeMask chromemask); + void (* command) (EphyEmbedShell *shell, + char *command, + char *param); + /* Methods */ void (* get_capabilities) (EphyEmbedShell *shell, diff --git a/embed/mozilla/StartHereProtocolHandler.cpp b/embed/mozilla/StartHereProtocolHandler.cpp index 2d2bb3c35..a4548378d 100644 --- a/embed/mozilla/StartHereProtocolHandler.cpp +++ b/embed/mozilla/StartHereProtocolHandler.cpp @@ -18,6 +18,9 @@ #include "ephy-file-helpers.h" #include "ephy-start-here.h" +#include "ephy-embed-shell.h" + +#include <string.h> #include "nsCOMPtr.h" #include "nsIFactory.h" @@ -121,6 +124,19 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI, rv = aURI->GetPath(path); if (NS_FAILED(rv)) return rv; + if (g_str_has_prefix (path.get(), "import-bookmarks")) + { + g_signal_emit_by_name (embed_shell, "command", "import-bookmarks", + path.get() + strlen ("import-bookmarks?")); + return NS_ERROR_FAILURE; + } + else if (g_str_has_prefix (path.get(), "configure-network")) + { + g_signal_emit_by_name (embed_shell, "command", "configure-network", + NULL); + return NS_ERROR_FAILURE; + } + nsCOMPtr<nsIStorageStream> sStream; nsCOMPtr<nsIOutputStream> stream; @@ -131,7 +147,8 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI, if (NS_FAILED(rv)) return rv; sh = ephy_start_here_new (); - buf = ephy_start_here_get_page (sh, "index"); + buf = ephy_start_here_get_page + (sh, path.IsEmpty() ? "index" : path.get ()); aBaseURI = ephy_start_here_get_base_uri (sh); rv = stream->Write (buf, strlen (buf), &bytesWritten); diff --git a/po/POTFILES.in b/po/POTFILES.in index 688f550e9..a19e46742 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,9 +1,12 @@ # List of source files containing translatable strings. # Please keep this file sorted alphabetically. +lib/ephy-start-here.c +src/ephy-shell.c data/GNOME_Epiphany_Automation.server.in data/GNOME_Epiphany_NautilusView.server.in data/epiphany.desktop.in data/starthere/index.xml.in +data/starthere/smartbookmarks.xml.in data/epiphany.schemas.in data/glade/epiphany.glade data/glade/prefs-dialog.glade diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 491b01b5f..2f2c207e6 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -26,7 +26,9 @@ #include "ephy-window.h" #include "ephy-file-helpers.h" #include "ephy-thread-helpers.h" +#include "ephy-bookmarks-import.h" +#include <string.h> #include <libgnomeui/gnome-client.h> #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-i18n.h> @@ -121,6 +123,38 @@ ephy_shell_class_init (EphyShellClass *klass) } static void +ephy_shell_command_cb (EphyEmbedShell *shell, + char *command, + char *param, + gpointer data) +{ + EphyBookmarks *bookmarks; + GtkWidget *dialog; + + bookmarks = ephy_shell_get_bookmarks (EPHY_SHELL (shell)); + + if (strcmp (command, "import-bookmarks") == 0) + { + ephy_bookmarks_import_mozilla (bookmarks, param); + + dialog = gtk_message_dialog_new + (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Bookmarks imported successfully.")); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + else if (strcmp (command, "configure-network") == 0) + { + ephy_file_launch_application ("gnome-network-preferences", + NULL, + FALSE); + } +} + +static void ephy_shell_new_window_cb (EphyEmbedShell *shell, EphyEmbed **new_embed, EmbedChromeMask chromemask, @@ -173,6 +207,11 @@ ephy_shell_init (EphyShell *gs) G_CALLBACK(ephy_shell_new_window_cb), NULL); + g_signal_connect (G_OBJECT (gs), + "command", + G_CALLBACK(ephy_shell_command_cb), + NULL); + ephy_init_services (gs); } |