From 54d2149bf268430f3b5f11e58c4492b1ab4c6ff5 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Fri, 19 Sep 2003 12:14:45 +0000 Subject: Add an --import-bookmarks command line option, and really implement the 2003-09-19 Christian Persch * idl/EphyAutomation.idl: * src/ephy-automation.c: (impl_ephy_automation_add_bookmark), (impl_ephy_automation_import_bookmarks), (ephy_automation_class_init): * src/ephy-main.c: (ephy_main_start): Add an --import-bookmarks command line option, and really implement the --add-bookmark one. --- src/ephy-automation.c | 18 ++++++++++++++++++ src/ephy-main.c | 10 ++++++++++ 2 files changed, 28 insertions(+) (limited to 'src') diff --git a/src/ephy-automation.c b/src/ephy-automation.c index 529b1854e..5980f9c09 100644 --- a/src/ephy-automation.c +++ b/src/ephy-automation.c @@ -24,6 +24,8 @@ #include "ephy-embed.h" #include "ephy-window.h" #include "session.h" +#include "ephy-bookmarks.h" +#include "ephy-bookmarks-import.h" #include #include @@ -35,6 +37,10 @@ impl_ephy_automation_add_bookmark (PortableServer_Servant _servant, const CORBA_char * url, CORBA_Environment * ev); static void +impl_ephy_automation_import_bookmarks (PortableServer_Servant _servant, + const CORBA_char * filename, + CORBA_Environment * ev); +static void impl_ephy_automation_quit (PortableServer_Servant _servant, const CORBA_boolean disableServer, CORBA_Environment * ev); @@ -149,6 +155,17 @@ impl_ephy_automation_add_bookmark (PortableServer_Servant _servant, const CORBA_char * url, CORBA_Environment * ev) { + ephy_bookmarks_add (ephy_shell_get_bookmarks (ephy_shell), + url /* title */, url); +} + +static void +impl_ephy_automation_import_bookmarks (PortableServer_Servant _servant, + const CORBA_char * filename, + CORBA_Environment * ev) +{ + ephy_bookmarks_import (ephy_shell_get_bookmarks (ephy_shell), + filename); } static void @@ -194,6 +211,7 @@ ephy_automation_class_init (EphyAutomationClass *klass) /* connect implementation callbacks */ epv->loadurl = impl_ephy_automation_loadurl; epv->addBookmark = impl_ephy_automation_add_bookmark; + epv->importBookmarks = impl_ephy_automation_import_bookmarks; epv->quit = impl_ephy_automation_quit; epv->loadSession = impl_ephy_automation_load_session; epv->openBookmarksEditor = impl_ephy_automation_open_bookmarks_editor; diff --git a/src/ephy-main.c b/src/ephy-main.c index 22c33b695..986588ed8 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -52,6 +52,7 @@ static gboolean open_in_new_window = FALSE; /* force open in a new window? static gboolean open_fullscreen = FALSE; /* open ephy in full screen ? */ static gchar *session_filename = NULL; /* the session filename */ static gchar *bookmark_url = NULL; /* the temp bookmark to add */ +static gchar *bookmarks_file = NULL; /* the bookmarks file to import */ static gboolean close_option = FALSE; /* --close */ static gboolean quit_option = FALSE; /* --quit */ static gboolean ephy_server_mode = FALSE; @@ -93,6 +94,9 @@ static struct poptOption popt_options[] = { "add-bookmark", 't', POPT_ARG_STRING, &bookmark_url, 0, N_("Add a bookmark (don't open any window)"), N_("URL")}, + { "import-bookmarks", '\0', POPT_ARG_STRING, &bookmarks_file, + 0, N_("Import bookmarks from the given file"), + N_("FILE") }, { "close", 'c', POPT_ARG_NONE, &close_option, 0, N_("Close all Epiphany windows"), NULL }, @@ -227,6 +231,12 @@ ephy_main_start (gpointer data) GNOME_EphyAutomation_loadSession (gaserver, session_filename, &corba_env); } + /* if we're given a bookmarks file to import... */ + else if (bookmarks_file != NULL) + { + GNOME_EphyAutomation_importBookmarks + (gaserver, bookmarks_file, &corba_env); + } /* if found and we're given a bookmark to add... */ else if (bookmark_url != NULL) { -- cgit v1.2.3