diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-02-02 07:42:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-02-02 07:42:48 +0800 |
commit | 3cc751a30e83efeed8fc9707d2069c545aa005c6 (patch) | |
tree | 3d1e4cee4a69ace5bc6a1d0d9ae28dfbebc7f698 | |
parent | ab9e3429d7c547aad67106a04847e16cda1279b4 (diff) | |
download | gsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.tar.gz gsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.tar.zst gsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.zip |
Define variants with startup ID.
2005-02-02 Christian Persch <chpe@cvs.gnome.org>
* idl/EphyAutomation.idl:
Define variants with startup ID.
* lib/ephy-gui.c: (ephy_gui_window_update_user_time):
* lib/ephy-gui.h:
* src/bookmarks/ephy-bookmarks.c: (redirect_cb):
* src/ephy-automation.c:
(impl_ephy_automation_loadUrlWithStartupId),
(impl_ephy_automation_loadurl), (impl_ephy_automation_addBookmark),
(impl_ephy_automation_importBookmarks),
(impl_ephy_automation_loadSessionWithStartupId),
(impl_ephy_automation_loadSession),
(impl_ephy_automation_openBookmarksEditorWithStartupId),
(impl_ephy_automation_openBookmarksEditor),
(ephy_automation_class_init):
* src/ephy-main.c: (get_startup_id), (main):
* src/ephy-session.c: (offer_to_resume), (ephy_session_autoresume),
(ephy_session_load):
* src/ephy-session.h:
* src/ephy-shell.c: (open_urls), (ephy_shell_startup),
(ephy_shell_new_tab_full), (ephy_shell_new_tab):
* src/ephy-shell.h:
Implement startup ID forwarding to the already-running ephy instance.
Part of bug #150085.
-rw-r--r-- | ChangeLog | 29 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-embed.sgml | 2 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-session.sgml | 2 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-shell.sgml | 1 | ||||
-rw-r--r-- | idl/EphyAutomation.idl | 11 | ||||
-rw-r--r-- | lib/ephy-gui.c | 14 | ||||
-rw-r--r-- | lib/ephy-gui.h | 3 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 3 | ||||
-rw-r--r-- | src/ephy-automation.c | 101 | ||||
-rw-r--r-- | src/ephy-main.c | 39 | ||||
-rw-r--r-- | src/ephy-session.c | 35 | ||||
-rw-r--r-- | src/ephy-session.h | 6 | ||||
-rw-r--r-- | src/ephy-shell.c | 67 | ||||
-rw-r--r-- | src/ephy-shell.h | 8 |
14 files changed, 270 insertions, 51 deletions
@@ -1,3 +1,32 @@ +2005-02-02 Christian Persch <chpe@cvs.gnome.org> + + * idl/EphyAutomation.idl: + + Define variants with startup ID. + + * lib/ephy-gui.c: (ephy_gui_window_update_user_time): + * lib/ephy-gui.h: + * src/bookmarks/ephy-bookmarks.c: (redirect_cb): + * src/ephy-automation.c: + (impl_ephy_automation_loadUrlWithStartupId), + (impl_ephy_automation_loadurl), (impl_ephy_automation_addBookmark), + (impl_ephy_automation_importBookmarks), + (impl_ephy_automation_loadSessionWithStartupId), + (impl_ephy_automation_loadSession), + (impl_ephy_automation_openBookmarksEditorWithStartupId), + (impl_ephy_automation_openBookmarksEditor), + (ephy_automation_class_init): + * src/ephy-main.c: (get_startup_id), (main): + * src/ephy-session.c: (offer_to_resume), (ephy_session_autoresume), + (ephy_session_load): + * src/ephy-session.h: + * src/ephy-shell.c: (open_urls), (ephy_shell_startup), + (ephy_shell_new_tab_full), (ephy_shell_new_tab): + * src/ephy-shell.h: + + Implement startup ID forwarding to the already-running ephy instance. + Part of bug #150085. + 2005-02-01 Christian Persch <chpe@cvs.gnome.org> * data/epiphany-lockdown.schemas.in: diff --git a/doc/reference/tmpl/ephy-embed.sgml b/doc/reference/tmpl/ephy-embed.sgml index 8f7eddc2f..fe5145716 100644 --- a/doc/reference/tmpl/ephy-embed.sgml +++ b/doc/reference/tmpl/ephy-embed.sgml @@ -211,6 +211,8 @@ be done by casting). @: @: @: +@: +@: @: <!-- ##### SIGNAL EphyEmbed::ge-security-change ##### --> diff --git a/doc/reference/tmpl/ephy-session.sgml b/doc/reference/tmpl/ephy-session.sgml index 4b3e753a3..6036738f2 100644 --- a/doc/reference/tmpl/ephy-session.sgml +++ b/doc/reference/tmpl/ephy-session.sgml @@ -40,6 +40,7 @@ ephy-session @session: @filename: +@user_time: @Returns: @@ -49,6 +50,7 @@ ephy-session </para> @session: +@user_time: @Returns: diff --git a/doc/reference/tmpl/ephy-shell.sgml b/doc/reference/tmpl/ephy-shell.sgml index 570c6a038..e0df50d62 100644 --- a/doc/reference/tmpl/ephy-shell.sgml +++ b/doc/reference/tmpl/ephy-shell.sgml @@ -87,6 +87,7 @@ ephy-shell @shell: @flags: +@startup_id: @args: @string_arg: @error: diff --git a/idl/EphyAutomation.idl b/idl/EphyAutomation.idl index 83f0c1f92..c3e21c347 100644 --- a/idl/EphyAutomation.idl +++ b/idl/EphyAutomation.idl @@ -15,6 +15,17 @@ module GNOME { void loadSession (in string filename); void openBookmarksEditor (); + + void loadUrlWithStartupId (in string url, + in boolean fullscreen, + in boolean open_in_existing_tab, + in boolean open_in_new_tab, + in unsigned long startup_id); + + void loadSessionWithStartupId (in string filename, + in unsigned long startup_id); + + void openBookmarksEditorWithStartupId (in unsigned long startup_id); }; }; diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c index 655e8fb4f..6b8a18497 100644 --- a/lib/ephy-gui.c +++ b/lib/ephy-gui.c @@ -26,6 +26,7 @@ #include <ctype.h> #include <string.h> #include <glib/gi18n.h> +#include <gdk/gdkx.h> #include <libgnome/gnome-help.h> #include <gtk/gtktreemodel.h> #include <gtk/gtkmessagedialog.h> @@ -343,3 +344,16 @@ ephy_gui_is_middle_click (void) return new_tab; } + +void +ephy_gui_window_update_user_time (GtkWidget *window, + guint32 user_time) +{ + if (user_time != 0) + { + gtk_widget_realize (window); + gdk_x11_window_set_user_time (window->window, + user_time); + } + +} diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h index aa40c0de2..7a9847281 100644 --- a/lib/ephy-gui.h +++ b/lib/ephy-gui.h @@ -68,6 +68,9 @@ void ephy_gui_help (GtkWindow *parent, const char *file_name, const char *link_id); +void ephy_gui_window_update_user_time (GtkWidget *window, + guint32 user_time); + G_END_DECLS #endif diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index b7c4e4993..0043d845a 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -564,6 +564,9 @@ redirect_cb (EphyHistory *history, (EphyNodeCallback) update_bookmark_destroy_cb, G_OBJECT (dialog)); + /* this dialogue is unexpected */ + gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE); + gtk_window_present (GTK_WINDOW (dialog)); } diff --git a/src/ephy-automation.c b/src/ephy-automation.c index d87ad1372..fac7600d1 100644 --- a/src/ephy-automation.c +++ b/src/ephy-automation.c @@ -32,6 +32,7 @@ #include "ephy-bookmarks-import.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" +#include "ephy-gui.h" #include <string.h> #include <bonobo/bonobo-main.h> @@ -42,16 +43,18 @@ static void ephy_automation_class_init (EphyAutomationClass *klass); static GObjectClass *parent_class = NULL; static void -impl_ephy_automation_loadurl (PortableServer_Servant _servant, - const CORBA_char *url, - const CORBA_boolean fullscreen, - const CORBA_boolean open_in_existing_tab, - const CORBA_boolean open_in_new_tab, - CORBA_Environment *ev) +impl_ephy_automation_loadUrlWithStartupId (PortableServer_Servant _servant, + const CORBA_char *url, + const CORBA_boolean fullscreen, + const CORBA_boolean open_in_existing_tab, + const CORBA_boolean open_in_new_tab, + const CORBA_unsigned_long startup_id, + CORBA_Environment *ev) { EphyNewTabFlags flags = 0; EphyWindow *window; EphySession *session; + guint32 user_time = (guint32) startup_id; session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); g_return_if_fail (session != NULL); @@ -61,7 +64,7 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, url = ""; } - if (ephy_session_autoresume (session) && *url == '\0') + if (ephy_session_autoresume (session, user_time) && *url == '\0') { /* no need to open the homepage, * we did already open session windows */ @@ -72,6 +75,8 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, if (open_in_existing_tab && window != NULL) { + ephy_gui_window_update_user_time (GTK_WIDGET (window), + user_time); ephy_window_load_url (window, url); return; } @@ -100,51 +105,96 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, flags |= EPHY_NEW_TAB_FULLSCREEN_MODE; } - ephy_shell_new_tab (ephy_shell, window, NULL, url, flags); + ephy_shell_new_tab_full (ephy_shell, window, NULL, url, flags, + user_time); +} + +static void +impl_ephy_automation_loadurl (PortableServer_Servant _servant, + const CORBA_char *url, + const CORBA_boolean fullscreen, + const CORBA_boolean open_in_existing_tab, + const CORBA_boolean open_in_new_tab, + CORBA_Environment *ev) +{ + impl_ephy_automation_loadUrlWithStartupId (_servant, + url, + fullscreen, + open_in_existing_tab, + open_in_new_tab, + 0, /* no startup ID */ + ev); } static void -impl_ephy_automation_add_bookmark (PortableServer_Servant _servant, - const CORBA_char * url, - CORBA_Environment * ev) +impl_ephy_automation_addBookmark (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) +impl_ephy_automation_importBookmarks (PortableServer_Servant _servant, + const CORBA_char *filename, + CORBA_Environment *ev) { ephy_bookmarks_import (ephy_shell_get_bookmarks (ephy_shell), filename); } static void -impl_ephy_automation_load_session (PortableServer_Servant _servant, - const CORBA_char * filename, - CORBA_Environment * ev) +impl_ephy_automation_loadSessionWithStartupId (PortableServer_Servant _servant, + const CORBA_char *filename, + const CORBA_unsigned_long startup_id, + CORBA_Environment *ev) { EphySession *session; + guint32 user_time = (guint32) startup_id; session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); - ephy_session_load (session, filename); + ephy_session_load (session, filename, user_time); +} + +static void +impl_ephy_automation_loadSession (PortableServer_Servant _servant, + const CORBA_char *filename, + CORBA_Environment *ev) +{ + impl_ephy_automation_loadSessionWithStartupId (_servant, + filename, + 0, /* no startup ID */ + ev); } static void -impl_ephy_automation_open_bookmarks_editor (PortableServer_Servant _servant, - CORBA_Environment * ev) +impl_ephy_automation_openBookmarksEditorWithStartupId (PortableServer_Servant _servant, + const CORBA_unsigned_long startup_id, + CORBA_Environment *ev) { GtkWidget *editor; + guint32 user_time = (guint32) startup_id; if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return; + editor = ephy_shell_get_bookmarks_editor (ephy_shell); + ephy_gui_window_update_user_time (editor, user_time); + gtk_window_present (GTK_WINDOW (editor)); } static void +impl_ephy_automation_openBookmarksEditor (PortableServer_Servant _servant, + CORBA_Environment *ev) +{ + impl_ephy_automation_openBookmarksEditorWithStartupId (_servant, + 0, /* no startup ID */ + ev); +} + +static void ephy_automation_init (EphyAutomation *c) { } @@ -158,10 +208,13 @@ 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->loadSession = impl_ephy_automation_load_session; - epv->openBookmarksEditor = impl_ephy_automation_open_bookmarks_editor; + epv->addBookmark = impl_ephy_automation_addBookmark; + epv->importBookmarks = impl_ephy_automation_importBookmarks; + epv->loadSession = impl_ephy_automation_loadSession; + epv->openBookmarksEditor = impl_ephy_automation_openBookmarksEditor; + epv->loadUrlWithStartupId = impl_ephy_automation_loadUrlWithStartupId; + epv->loadSessionWithStartupId = impl_ephy_automation_loadSessionWithStartupId; + epv->openBookmarksEditorWithStartupId = impl_ephy_automation_openBookmarksEditorWithStartupId; } BONOBO_TYPE_FUNC_FULL ( diff --git a/src/ephy-main.c b/src/ephy-main.c index 042fd1f27..5a62232ca 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -38,6 +38,7 @@ #include <libgnomevfs/gnome-vfs-init.h> #include <libgnomevfs/gnome-vfs-utils.h> #include <libxml/xmlversion.h> +#include <errno.h> static gboolean open_in_existing = FALSE; static gboolean open_in_new_tab = FALSE; @@ -71,6 +72,39 @@ static struct poptOption popt_options[] = { NULL, 0, 0, NULL, 0, NULL, NULL } }; +/* adapted from gtk+/gdk/x11/gdkdisplay-x11.c */ +static guint32 +get_startup_id (void) +{ + const char *startup_id, *time_str; + guint32 retval = 0; + + startup_id = g_getenv ("DESKTOP_STARTUP_ID"); + if (startup_id == NULL) return 0; + + /* Find the launch time from the startup_id, if it's there. Newer spec + * states that the startup_id is of the form <unique>_TIME<timestamp> + */ + time_str = g_strrstr (startup_id, "_TIME"); + if (time_str != NULL) + { + gulong value; + gchar *end; + errno = 0; + + /* Skip past the "_TIME" part */ + time_str += 5; + + value = strtoul (time_str, &end, 0); + if (end != time_str && errno == 0) + { + retval = (guint32) value; + } + } + + return retval; +} + static void handle_url (GtkAboutDialog *about, const char *link, @@ -114,6 +148,7 @@ main (int argc, char *argv[]) GnomeProgram *program; EphyShellStartupFlags startup_flags; const char **args, *string_arg; + guint32 user_time; gboolean new_instance; GError *err = NULL; @@ -129,6 +164,9 @@ main (int argc, char *argv[]) */ LIBXML_TEST_VERSION + /* get this early, since gdk will unset the env var */ + user_time = get_startup_id (); + program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_POPT_TABLE, popt_options, @@ -198,6 +236,7 @@ main (int argc, char *argv[]) ephy_shell_new (); g_assert (ephy_shell != NULL); new_instance = ephy_shell_startup (ephy_shell, startup_flags, + user_time, args, string_arg, &err); if (err != NULL) diff --git a/src/ephy-session.c b/src/ephy-session.c index 117081c83..49ca547d9 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -32,6 +32,7 @@ #include "ephy-file-helpers.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" +#include "ephy-gui.h" #include "ephy-debug.h" #include <glib/gi18n.h> @@ -357,7 +358,8 @@ ephy_session_class_init (EphySessionClass *class) } static gboolean -offer_to_resume (EphySession *session) +offer_to_resume (EphySession *session, + guint32 user_time) { GtkWidget *dialog; int response; @@ -385,6 +387,9 @@ offer_to_resume (EphySession *session) session->priv->resume_dialog = dialog; + ephy_gui_window_update_user_time (session->priv->resume_dialog, + user_time); + response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -397,6 +402,7 @@ offer_to_resume (EphySession *session) /** * ephy_session_autoresume: * @session: a #EphySession + * @user_time: a timestamp, or 0 * * Resume a crashed session when necessary (interactive) * @@ -405,28 +411,33 @@ offer_to_resume (EphySession *session) * has been re-presented to the user. **/ gboolean -ephy_session_autoresume (EphySession *session) +ephy_session_autoresume (EphySession *session, + guint32 user_time) { + EphySessionPrivate *priv = session->priv; char *saved_session; gboolean retval = FALSE; LOG ("ephy_session_autoresume"); - if (session->priv->windows != NULL || session->priv->tool_windows != NULL) return FALSE; + if (priv->windows != NULL || priv->tool_windows != NULL) return FALSE; - if (session->priv->resume_dialog) + if (priv->resume_dialog) { - gtk_window_present (GTK_WINDOW (session->priv->resume_dialog)); + ephy_gui_window_update_user_time (session->priv->resume_dialog, + user_time); + gtk_window_present (GTK_WINDOW (priv->resume_dialog)); return TRUE; } saved_session = get_session_filename (SESSION_CRASHED); if (g_file_test (saved_session, G_FILE_TEST_EXISTS) - && offer_to_resume (session)) + && offer_to_resume (session, user_time)) { session->priv->dont_save = TRUE; - retval = ephy_session_load (session, saved_session); + retval = ephy_session_load (session, saved_session, + user_time); session->priv->dont_save = FALSE; ephy_session_save (session, SESSION_CRASHED); } @@ -738,6 +749,7 @@ restore_geometry (GtkWindow *window, * ephy_session_load: * @session: a #EphySession * @filename: the path of the source file + * @user_time: a timestamp, or 0 * * Load a session from disk, restoring the windows and their state * @@ -745,7 +757,8 @@ restore_geometry (GtkWindow *window, **/ gboolean ephy_session_load (EphySession *session, - const char *filename) + const char *filename, + guint32 user_time) { xmlDocPtr doc; xmlNodePtr child; @@ -776,6 +789,9 @@ ephy_session_load (EphySession *session, widget = GTK_WIDGET (ephy_window_new ()); restore_geometry (GTK_WINDOW (widget), child); parse_embed (child->children, EPHY_WINDOW (widget)); + + ephy_gui_window_update_user_time (widget, user_time); + gtk_window_present (GTK_WINDOW (widget)); } else if (xmlStrEqual (child->name, (const xmlChar *) "toolwindow")) @@ -800,6 +816,9 @@ ephy_session_load (EphySession *session, } restore_geometry (GTK_WINDOW (widget), child); + + ephy_gui_window_update_user_time (widget, user_time); + gtk_window_present (GTK_WINDOW (widget)); } diff --git a/src/ephy-session.h b/src/ephy-session.h index d595ef06a..025f8425d 100644 --- a/src/ephy-session.h +++ b/src/ephy-session.h @@ -63,9 +63,11 @@ gboolean ephy_session_save (EphySession *session, const char *filename); gboolean ephy_session_load (EphySession *session, - const char *filename); + const char *filename, + guint32 user_time); -gboolean ephy_session_autoresume (EphySession *session); +gboolean ephy_session_autoresume (EphySession *session, + guint32 user_time); void ephy_session_close (EphySession *session); diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 191f552bc..dc9647df5 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -46,6 +46,7 @@ #include "ephy-automation.h" #include "print-dialog.h" #include "ephy-prefs.h" +#include "ephy-gui.h" #ifdef ENABLE_DBUS #include "ephy-dbus.h" @@ -308,8 +309,11 @@ path_from_command_line_arg (const char *arg) static void open_urls (GNOME_EphyAutomation automation, - const char **args, CORBA_Environment *ev, - gboolean new_tab, gboolean existing_window, + guint32 user_time, + const char **args, + CORBA_Environment *ev, + gboolean new_tab, + gboolean existing_window, gboolean fullscreen) { int i; @@ -317,9 +321,9 @@ open_urls (GNOME_EphyAutomation automation, if (args == NULL) { /* Homepage or resume */ - GNOME_EphyAutomation_loadurl + GNOME_EphyAutomation_loadUrlWithStartupId (automation, "", fullscreen, - existing_window, new_tab, ev); + existing_window, new_tab, user_time, ev); } else { @@ -329,9 +333,9 @@ open_urls (GNOME_EphyAutomation automation, path = path_from_command_line_arg (args[i]); - GNOME_EphyAutomation_loadurl + GNOME_EphyAutomation_loadUrlWithStartupId (automation, path, fullscreen, - existing_window, new_tab, ev); + existing_window, new_tab, user_time, ev); g_free (path); } @@ -410,6 +414,7 @@ gnome_session_init (EphyShell *shell) gboolean ephy_shell_startup (EphyShell *shell, EphyShellStartupFlags flags, + guint32 user_time, const char **args, const char *string_arg, GError **error) @@ -465,13 +470,13 @@ ephy_shell_startup (EphyShell *shell, } else if (flags & EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR) { - GNOME_EphyAutomation_openBookmarksEditor - (automation, &ev); + GNOME_EphyAutomation_openBookmarksEditorWithStartupId + (automation, user_time, &ev); } else if (flags & EPHY_SHELL_STARTUP_SESSION) { - GNOME_EphyAutomation_loadSession - (automation, string_arg, &ev); + GNOME_EphyAutomation_loadSessionWithStartupId + (automation, string_arg, user_time, &ev); } else if (flags & EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS) { @@ -485,7 +490,7 @@ ephy_shell_startup (EphyShell *shell, } else { - open_urls (automation, args, &ev, + open_urls (automation, user_time, args, &ev, flags & EPHY_SHELL_STARTUP_TABS, flags & EPHY_SHELL_STARTUP_EXISTING_WINDOW, flags & EPHY_SHELL_STARTUP_FULLSCREEN); @@ -639,11 +644,12 @@ load_homepage (EphyEmbed *embed) } /** - * ephy_shell_new_tab: + * ephy_shell_new_tab_full: * @shell: a #EphyShell * @parent_window: the target #EphyWindow or %NULL * @previous_tab: the referrer tab or %NULL * @url: an url to load or %NULL + * @user_time: a timestamp, or 0 * * Create a new tab and the parent window when necessary. * Use this function to open urls in new window/tabs. @@ -651,11 +657,12 @@ load_homepage (EphyEmbed *embed) * ReturnValue: the created #EphyTab **/ EphyTab * -ephy_shell_new_tab (EphyShell *shell, - EphyWindow *parent_window, - EphyTab *previous_tab, - const char *url, - EphyNewTabFlags flags) +ephy_shell_new_tab_full (EphyShell *shell, + EphyWindow *parent_window, + EphyTab *previous_tab, + const char *url, + EphyNewTabFlags flags, + guint32 user_time) { EphyWindow *window; EphyTab *tab; @@ -705,6 +712,9 @@ ephy_shell_new_tab (EphyShell *shell, embed = ephy_tab_get_embed (tab); ephy_window_add_tab (window, tab, position, jump_to); + + ephy_gui_window_update_user_time (GTK_WIDGET (window), user_time); + gtk_widget_show (GTK_WIDGET (window)); if (flags & EPHY_NEW_TAB_HOME_PAGE || @@ -729,6 +739,29 @@ ephy_shell_new_tab (EphyShell *shell, } /** + * ephy_shell_new_tab: + * @shell: a #EphyShell + * @parent_window: the target #EphyWindow or %NULL + * @previous_tab: the referrer tab or %NULL + * @url: an url to load or %NULL + * + * Create a new tab and the parent window when necessary. + * Use this function to open urls in new window/tabs. + * + * ReturnValue: the created #EphyTab + **/ +EphyTab * +ephy_shell_new_tab (EphyShell *shell, + EphyWindow *parent_window, + EphyTab *previous_tab, + const char *url, + EphyNewTabFlags flags) +{ + return ephy_shell_new_tab_full (shell, parent_window, + previous_tab, url, flags, 0); +} + +/** * ephy_shell_get_session: * @shell: the #EphyShell * diff --git a/src/ephy-shell.h b/src/ephy-shell.h index 9bc1fe06d..84b86d340 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -112,6 +112,7 @@ EphyShell *ephy_shell_new (void); gboolean ephy_shell_startup (EphyShell *shell, EphyShellStartupFlags flags, + guint32 user_time, const char **args, const char *string_arg, GError **error); @@ -122,6 +123,13 @@ EphyTab *ephy_shell_new_tab (EphyShell *shell, const char *url, EphyNewTabFlags flags); +EphyTab *ephy_shell_new_tab_full (EphyShell *shell, + EphyWindow *parent_window, + EphyTab *previous_tab, + const char *url, + EphyNewTabFlags flags, + guint32 user_time); + GObject *ephy_shell_get_session (EphyShell *shell); EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *shell); |