aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-main.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-02-02 07:42:48 +0800
committerChristian Persch <chpe@src.gnome.org>2005-02-02 07:42:48 +0800
commit3cc751a30e83efeed8fc9707d2069c545aa005c6 (patch)
tree3d1e4cee4a69ace5bc6a1d0d9ae28dfbebc7f698 /src/ephy-main.c
parentab9e3429d7c547aad67106a04847e16cda1279b4 (diff)
downloadgsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.tar
gsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.tar.gz
gsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.tar.bz2
gsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.tar.lz
gsoc2013-epiphany-3cc751a30e83efeed8fc9707d2069c545aa005c6.tar.xz
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.
Diffstat (limited to 'src/ephy-main.c')
-rw-r--r--src/ephy-main.c39
1 files changed, 39 insertions, 0 deletions
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)