diff --exclude-from=/home/dang/.diffrc -u -ruN epiphany-extensions-2.16.0.orig/configure epiphany-extensions-2.16.0/configure --- epiphany-extensions-2.16.0.orig/configure 2006-09-03 13:56:14.000000000 -0400 +++ epiphany-extensions-2.16.0/configure 2006-10-05 15:50:42.000000000 -0400 @@ -23420,7 +23420,7 @@ echo "$as_me:$LINENO: checking which extensions to build" >&5 echo $ECHO_N "checking which extensions to build... $ECHO_C" >&6 -ALL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures greasemonkey java-console livehttpheaders page-info permissions push-scroller rss sample sample-mozilla select-stylesheet sidebar smart-bookmarks tab-groups tab-states" +ALL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures greasemonkey java-console livehttpheaders page-info permissions push-scroller rss sample sample-mozilla select-stylesheet sessionsaver sidebar smart-bookmarks tab-groups tab-states" USEFUL_EXTENSIONS="actions auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures java-console page-info push-scroller select-stylesheet sidebar smart-bookmarks tab-groups tab-states" DEFAULT_EXTENSIONS="actions auto-scroller certificates error-viewer extensions-manager-ui gestures java-console page-info push-scroller select-stylesheet sidebar smart-bookmarks tab-groups tab-states" diff --exclude-from=/home/dang/.diffrc -u -ruN epiphany-extensions-2.16.0.orig/configure.ac epiphany-extensions-2.16.0/configure.ac --- epiphany-extensions-2.16.0.orig/configure.ac 2006-09-03 13:55:48.000000000 -0400 +++ epiphany-extensions-2.16.0/configure.ac 2006-10-05 16:36:30.000000000 -0400 @@ -151,7 +151,7 @@ AC_MSG_CHECKING([which extensions to build]) -ALL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures greasemonkey java-console livehttpheaders page-info permissions push-scroller rss sample sample-mozilla select-stylesheet sidebar smart-bookmarks tab-groups tab-states" +ALL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures greasemonkey java-console livehttpheaders page-info permissions push-scroller rss sample sample-mozilla select-stylesheet sessionsaver sidebar smart-bookmarks tab-groups tab-states" USEFUL_EXTENSIONS="actions auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures java-console page-info push-scroller select-stylesheet sidebar smart-bookmarks tab-groups tab-states" DEFAULT_EXTENSIONS="actions auto-scroller certificates error-viewer extensions-manager-ui gestures java-console page-info push-scroller select-stylesheet sidebar smart-bookmarks tab-groups tab-states" @@ -362,6 +362,7 @@ extensions/sample-python/Makefile extensions/select-stylesheet/Makefile extensions/select-stylesheet/mozilla/Makefile +extensions/sessionsaver/Makefile extensions/sidebar/Makefile extensions/smart-bookmarks/Makefile extensions/smart-bookmarks/mozilla/Makefile diff --exclude-from=/home/dang/.diffrc -u -ruN epiphany-extensions-2.16.0.orig/extensions/sessionsaver/ephy-sessionsaver-extension.c epiphany-extensions-2.16.0/extensions/sessionsaver/ephy-sessionsaver-extension.c --- epiphany-extensions-2.16.0.orig/extensions/sessionsaver/ephy-sessionsaver-extension.c 1969-12-31 19:00:00.000000000 -0500 +++ epiphany-extensions-2.16.0/extensions/sessionsaver/ephy-sessionsaver-extension.c 2006-07-31 11:31:43.000000000 -0400 @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2006 Gustavo Gama + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: ephy-sessionsaver-extension.c,v 1.5 2005/01/28 22:30:17 chpe Exp $ + */ + +#include "config.h" + +#include "ephy-sessionsaver-extension.h" +#include "ephy-debug.h" +#include "ephy-file-helpers.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#define EPHY_SESSIONSAVER_EXTENSION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SESSIONSAVER_EXTENSION, EphySessionSaverExtensionPrivate)) + +#define WINDOW_DATA_KEY "SessionSaverUIEWindowData" +#define SESSIONSAVER_DEFAULT_SESSION_FILE "sessionsaver_default.xml" + +struct _EphySessionSaverExtensionPrivate +{ + gboolean loaded; +}; + +typedef struct +{ + EphySessionSaverExtension *extension; + GtkActionGroup *action_group; + guint ui_id; +} WindowData; + +static GObjectClass *parent_class = NULL; + +static GType type = 0; + +static void quit_cb (GtkAction *action, + EphyWindow *window); + +static gboolean delete_window_cb (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +static const GtkActionEntry action_entries [] = +{ + { "SessionSaverUIQuitItem", + NULL, + N_("_Quit"), + "Q", + N_("Quit"), + G_CALLBACK (quit_cb) }, +}; + +static void +ephy_sessionsaver_extension_init (EphySessionSaverExtension *extension) +{ + char *session_file; + EphyShell *shell; + EphySession *session; + + LOG ("EphySessionSaverExtension initialising"); + extension->priv = EPHY_SESSIONSAVER_EXTENSION_GET_PRIVATE (extension); + extension->priv->loaded = FALSE; + + /* check for existance of the default sessionsaver session file */ + session_file = g_build_filename (ephy_dot_dir (), + SESSIONSAVER_DEFAULT_SESSION_FILE, + NULL); + if (g_file_test (session_file, + G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) == TRUE) + { + + shell = ephy_shell_get_default (); + session = EPHY_SESSION (ephy_shell_get_session (shell)); + + ephy_session_queue_command + (session, EPHY_SESSION_CMD_LOAD_SESSION, session_file, + NULL, (guint32) time(NULL), FALSE); + + /* the session file is no longer unlinked here. Since the + * session queue will only be processed afterwards, it is + * important to ensure that there will *exist* a session file + * by the time the session command is processed. The removal + * of the session file is thus delayed until the (first) window + * is attached. */ + } + + g_free (session_file); +} + +static void +ephy_sessionsaver_extension_finalize (GObject *object) +{ + LOG ("EphySessionSaverExtension finalising"); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +save_session (EphySession *session) +{ + char *session_file; + + session_file = g_build_filename (ephy_dot_dir (), + SESSIONSAVER_DEFAULT_SESSION_FILE, + NULL); + ephy_session_save (session, session_file); + g_free (session_file); +} + +static void +quit_cb (GtkAction *action, + EphyWindow *window) +{ + WindowData *data; + EphyShell *shell; + EphySession *session; + + LOG ("SessionSaver quit"); + data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY); + g_return_if_fail (data != NULL); + + shell = ephy_shell_get_default (); + session = EPHY_SESSION( ephy_shell_get_session (shell) ); + + save_session (session); + + ephy_session_close(session); +} + +static gboolean +delete_window_cb (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + EphyWindow *window; + EphyShell *shell; + EphySession *session; + GList *windows; + + window = EPHY_WINDOW (widget); + + shell = ephy_shell_get_default (); + session = EPHY_SESSION( ephy_shell_get_session (shell) ); + + windows = ephy_session_get_windows (session); + if (g_list_length(windows) == 1) { + /* the user closed the last window; save the session before + * quiting */ + save_session (session); + } + + g_signal_handlers_disconnect_by_func (window, + G_CALLBACK (delete_window_cb), + NULL); + return FALSE; +} + +static void +impl_attach_window (EphyExtension *ext, + EphyWindow *window) +{ + GtkUIManager *manager; + WindowData *data; + + data = g_new (WindowData, 1); + data->extension = EPHY_SESSIONSAVER_EXTENSION (ext); + + manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); + data->action_group = gtk_action_group_new ("SessionSaverUIEActions"); + gtk_action_group_set_translation_domain (data->action_group, GETTEXT_PACKAGE); + gtk_action_group_add_actions (data->action_group, action_entries, + G_N_ELEMENTS (action_entries), window); + + gtk_ui_manager_insert_action_group (manager, data->action_group, -1); + g_object_unref (data->action_group); + + data->ui_id = gtk_ui_manager_new_merge_id (manager); + + g_object_set_data_full (G_OBJECT (window), WINDOW_DATA_KEY, data, + (GDestroyNotify) g_free); + + gtk_ui_manager_add_ui (manager, data->ui_id, "/menubar/FileMenu", + "SessionSaverUIQuitItem", "SessionSaverUIQuitItem", + GTK_UI_MANAGER_MENUITEM, FALSE); + + g_signal_connect (G_OBJECT (window), "delete-event", + G_CALLBACK (delete_window_cb), NULL); + + /* if this is the first window attached, set the appropriate flag + * and remove the session file */ + if (data->extension->priv->loaded == FALSE) { + char *session_file; + + data->extension->priv->loaded = TRUE; + + /* check for existance of the default sessionsaver session file */ + session_file = g_build_filename (ephy_dot_dir (), + SESSIONSAVER_DEFAULT_SESSION_FILE, + NULL); + if (g_file_test (session_file, + G_FILE_TEST_EXISTS | + G_FILE_TEST_IS_REGULAR) == TRUE) + { + gnome_vfs_unlink (session_file); + } + + g_free (session_file); + } +} + +static void +impl_detach_window (EphyExtension *ext, + EphyWindow *window) +{ + GtkUIManager *manager; + WindowData *data; + + manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); + + data = (WindowData *) g_object_get_data (G_OBJECT (window), + WINDOW_DATA_KEY); + g_return_if_fail (data != NULL); + + gtk_ui_manager_remove_ui (manager, data->ui_id); + gtk_ui_manager_remove_action_group (manager, data->action_group); + + g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL); +} + +static void +ephy_sessionsaver_extension_iface_init (EphyExtensionIface *iface) +{ + iface->attach_window = impl_attach_window; + iface->detach_window = impl_detach_window; +} + +static void +ephy_sessionsaver_extension_class_init (EphySessionSaverExtensionClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + parent_class = g_type_class_peek_parent (klass); + object_class->finalize = ephy_sessionsaver_extension_finalize; + g_type_class_add_private (object_class, sizeof (EphySessionSaverExtensionPrivate)); +} + +GType +ephy_sessionsaver_extension_get_type (void) +{ + return type; +} + +GType +ephy_sessionsaver_extension_register_type (GTypeModule *module) +{ + static const GTypeInfo our_info = + { + sizeof (EphySessionSaverExtensionClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ephy_sessionsaver_extension_class_init, + NULL, + NULL, /* class_data */ + sizeof (EphySessionSaverExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) ephy_sessionsaver_extension_init + }; + + static const GInterfaceInfo extension_info = + { + (GInterfaceInitFunc) ephy_sessionsaver_extension_iface_init, + NULL, + NULL + }; + + type = g_type_module_register_type (module, + G_TYPE_OBJECT, + "EphySessionSaverExtension", + &our_info, 0); + + g_type_module_add_interface (module, + type, + EPHY_TYPE_EXTENSION, + &extension_info); + + return type; +} + +/* vim: set tabstop=8 shiftwidth=8 noexpandtab: */ diff --exclude-from=/home/dang/.diffrc -u -ruN epiphany-extensions-2.16.0.orig/extensions/sessionsaver/ephy-sessionsaver-extension.h epiphany-extensions-2.16.0/extensions/sessionsaver/ephy-sessionsaver-extension.h --- epiphany-extensions-2.16.0.orig/extensions/sessionsaver/ephy-sessionsaver-extension.h 1969-12-31 19:00:00.000000000 -0500 +++ epiphany-extensions-2.16.0/extensions/sessionsaver/ephy-sessionsaver-extension.h 2006-04-04 14:44:48.000000000 -0400 @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2003 Marco Pesenti Gritti + * Copyright (C) 2003 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: ephy-sessionsaver-extension.h,v 1.2 2004/12/30 22:42:23 chpe Exp $ + */ + +#ifndef EPHY_SESSIONSAVER_EXTENSION_H +#define EPHY_SESSIONSAVER_EXTENSION_H + +#include +#include + +G_BEGIN_DECLS + +#define EPHY_TYPE_SESSIONSAVER_EXTENSION (ephy_sessionsaver_extension_get_type ()) +#define EPHY_SESSIONSAVER_EXTENSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SESSIONSAVER_EXTENSION, EphySessionSaverExtension)) +#define EPHY_SESSIONSAVER_EXTENSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SESSIONSAVER_EXTENSION, EphySessionSaverExtensionClass)) +#define EPHY_IS_SESSIONSAVER_EXTENSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SESSIONSAVER_EXTENSION)) +#define EPHY_IS_SESSIONSAVER_EXTENSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SESSIONSAVER_EXTENSION)) +#define EPHY_SESSIONSAVER_EXTENSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SESSIONSAVER_EXTENSION, EphySessionSaverExtensionClass)) + +typedef struct _EphySessionSaverExtension EphySessionSaverExtension; +typedef struct _EphySessionSaverExtensionClass EphySessionSaverExtensionClass; +typedef struct _EphySessionSaverExtensionPrivate EphySessionSaverExtensionPrivate; + +struct _EphySessionSaverExtensionClass +{ + GObjectClass parent_class; +}; + +struct _EphySessionSaverExtension +{ + GObject parent_instance; + + /*< private >*/ + EphySessionSaverExtensionPrivate *priv; +}; + +GType ephy_sessionsaver_extension_get_type (void); + +GType ephy_sessionsaver_extension_register_type (GTypeModule *module); + +G_END_DECLS + +#endif diff --exclude-from=/home/dang/.diffrc -u -ruN epiphany-extensions-2.16.0.orig/extensions/sessionsaver/Makefile.am epiphany-extensions-2.16.0/extensions/sessionsaver/Makefile.am --- epiphany-extensions-2.16.0.orig/extensions/sessionsaver/Makefile.am 1969-12-31 19:00:00.000000000 -0500 +++ epiphany-extensions-2.16.0/extensions/sessionsaver/Makefile.am 2006-04-04 14:36:32.000000000 -0400 @@ -0,0 +1,34 @@ +extensiondir = $(EXTENSIONS_DIR) +extension_LTLIBRARIES = libsessionsaverextension.la + +libsessionsaverextension_la_SOURCES = \ + ephy-sessionsaver-extension.c \ + ephy-sessionsaver-extension.h \ + sessionsaver.c +libsessionsaverextension_la_LDFLAGS = -module -avoid-version + +libsessionsaverextension_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -DSHARE_DIR=\"$(pkgdatadir)\" \ + -DEPHY_EXTENSIONS_LOCALEDIR=\"$(datadir)/locale\" \ + $(AM_CPPFLAGS) + +libsessionsaverextension_la_CFLAGS = \ + $(EPIPHANY_DEPENDENCY_CFLAGS) \ + $(AM_CFLAGS) + +extensioninidir = $(extensiondir) +extensionini_in_files = sessionsaver.ephy-extension.in.in +extensionini_DATA = $(extensionini_in_files:.ephy-extension.in.in=.ephy-extension) + +%.ephy-extension.in: %.ephy-extension.in.in $(extension_LTLIBRARIES) + sed -e "s|%LIBRARY%|`. ./$(extension_LTLIBRARIES) && echo $$dlname`|" \ + -e "s|%EXTENSION_DIR%|$(extensiondir)|" \ + $< > $@ + +@EPIPHANY_EXTENSION_RULE@ + +CLEANFILES = $(extensionini_DATA) +DISTCLEANFILES = $(extensionini_DATA) + +EXTRA_DIST = $(extensionini_in_files) diff --exclude-from=/home/dang/.diffrc -u -ruN epiphany-extensions-2.16.0.orig/extensions/sessionsaver/sessionsaver.c epiphany-extensions-2.16.0/extensions/sessionsaver/sessionsaver.c --- epiphany-extensions-2.16.0.orig/extensions/sessionsaver/sessionsaver.c 1969-12-31 19:00:00.000000000 -0500 +++ epiphany-extensions-2.16.0/extensions/sessionsaver/sessionsaver.c 2006-04-04 14:36:32.000000000 -0400 @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2003 Marco Pesenti Gritti + * Copyright (C) 2003, 2004 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: sessionsaver.c,v 1.5 2005/01/28 22:30:17 chpe Exp $ + */ + +#include "config.h" + +#include "ephy-sessionsaver-extension.h" +#include "ephy-debug.h" + +#include +#include + +G_MODULE_EXPORT GType register_module (GTypeModule *module); + +G_MODULE_EXPORT GType +register_module (GTypeModule *module) +{ + LOG ("Registering EphySessionSaverExtension"); + +#ifdef ENABLE_NLS + /* Initialise the i18n stuff */ + bindtextdomain (GETTEXT_PACKAGE, EPHY_EXTENSIONS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + + return ephy_sessionsaver_extension_register_type (module); +} diff --exclude-from=/home/dang/.diffrc -u -ruN epiphany-extensions-2.16.0.orig/extensions/sessionsaver/sessionsaver.ephy-extension.in.in epiphany-extensions-2.16.0/extensions/sessionsaver/sessionsaver.ephy-extension.in.in --- epiphany-extensions-2.16.0.orig/extensions/sessionsaver/sessionsaver.ephy-extension.in.in 1969-12-31 19:00:00.000000000 -0500 +++ epiphany-extensions-2.16.0/extensions/sessionsaver/sessionsaver.ephy-extension.in.in 2006-07-31 11:53:13.000000000 -0400 @@ -0,0 +1,11 @@ +[Epiphany Extension] +_Name=SessionSaver +_Description=Session Saver Extension +Authors=Gustavo Gama <gama (at) vettalabs (dot) org> +Version=0.4 +URL=http://www.gnome.org/projects/epiphany/extensions.html + + +[Loader] +Type=shlib +Library=%EXTENSION_DIR%/%LIBRARY%