Index: extensions/exit/exit.ephy-extension.in.in =================================================================== --- extensions/exit/exit.ephy-extension.in.in (revisión: 0) +++ extensions/exit/exit.ephy-extension.in.in (revisión: 0) @@ -0,0 +1,11 @@ +[Epiphany Extension] +_Name=Exit +_Description=Exit epiphany saving then current session +Authors=Carlos Garcia Campos +Version=1 +URL= + + +[Loader] +Type=shlib +Library=%EXTENSION_DIR%/%LIBRARY% Index: extensions/exit/ephy-exit-extension.c =================================================================== --- extensions/exit/ephy-exit-extension.c (revisión: 0) +++ extensions/exit/ephy-exit-extension.c (revisión: 0) @@ -0,0 +1,330 @@ +/* + * Copyright © 2003 Marco Pesenti Gritti + * Copyright © 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-exit-extension.c 1634 2007-11-04 01:24:04Z cyrilbois $ + */ + +#include "config.h" + +#include "ephy-exit-extension.h" +#include "ephy-debug.h" +#include "ephy-file-helpers.h" +#include "eel-gconf-extensions.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#define EPHY_EXIT_EXTENSION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EXIT_EXTENSION, EphyExitExtensionPrivate)) + +struct _EphyExitExtensionPrivate +{ + GtkActionGroup *action_group; + + gchar *session_filename; + guint gconf_id; +}; + +#define WINDOW_DATA_KEY "EphyExitExtensionWindowData" +#define DISABLE_QUIT_KEY "/apps/epiphany/lockdown/disable_quit" + +static GObjectClass *parent_class = NULL; + +static GType type = 0; + +typedef struct +{ + EphyExitExtension *extension; + + guint merge_id; +} WindowData; + +static void ephy_exit_extension_cmd_file_quit (GtkAction *action, + EphyWindow *window); + +static const GtkActionEntry action_entries[] = +{ + { "FileQuit", GTK_STOCK_QUIT, N_("_Quit"), "Q", + N_("Exit epiphany saving then current session"), + G_CALLBACK (ephy_exit_extension_cmd_file_quit) } +}; + +static void +ephy_exit_extension_load_session (EphyExitExtension *extension) +{ + EphySession *session; + + if (!extension->priv->session_filename) + return; + + if (!g_file_test (extension->priv->session_filename, + G_FILE_TEST_IS_REGULAR)) + return; + + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); + ephy_session_queue_command (session, + EPHY_SESSION_CMD_LOAD_SESSION, + extension->priv->session_filename, + NULL, GDK_CURRENT_TIME, FALSE); +} + +static void +ephy_exit_extension_save_session (EphyExitExtension *extension) +{ + EphySession *session; + + if (!extension->priv->session_filename) + return; + + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); + ephy_session_save (session, extension->priv->session_filename); +} + +static gboolean +ephy_exit_extension_window_quit (EphyWindow *window) +{ + gboolean retval; + + g_signal_emit_by_name (G_OBJECT (window), "delete-event", NULL, &retval); + + return FALSE; +} + +static void +ephy_exit_extension_cmd_file_quit (GtkAction *action, EphyWindow *window) +{ + WindowData *data; + + LOG ("Exit ephy"); + + data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY); + ephy_exit_extension_save_session (data->extension); + + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, + (GSourceFunc)ephy_exit_extension_window_quit, + window, + (GDestroyNotify)gtk_widget_destroy); +} + +static void +ephy_exit_extension_update_sensitivity (EphyExitExtension *extension) +{ + GtkAction *action; + + action = gtk_action_group_get_action (extension->priv->action_group, "FileQuit"); + gtk_action_set_sensitive (action, !eel_gconf_get_boolean (DISABLE_QUIT_KEY)); +} + +static void +ephy_exit_extension_disable_quit_cb (GConfClient *client, + guint id, + GConfEntry *entry, + EphyExitExtension *extension) +{ + ephy_exit_extension_update_sensitivity (extension); +} + +static void +ephy_exit_extension_init (EphyExitExtension *extension) +{ + gchar *session_crashed; + + extension->priv = EPHY_EXIT_EXTENSION_GET_PRIVATE (extension); + + LOG ("EphyExitExtension initialising"); + + extension->priv->gconf_id = + eel_gconf_notification_add (DISABLE_QUIT_KEY, + (GConfClientNotifyFunc) ephy_exit_extension_disable_quit_cb, + extension); + + extension->priv->session_filename = + g_build_filename (ephy_dot_dir (), + "ephy-session.xml", + NULL); + + session_crashed = + g_build_filename (ephy_dot_dir (), + "session_crashed.xml", + NULL); + + /* If last session crashed, user will decide whether resume */ + if (!g_file_test (session_crashed, G_FILE_TEST_IS_REGULAR)) + ephy_exit_extension_load_session (extension); + g_free (session_crashed); +} + +static void +ephy_exit_extension_finalize (GObject *object) +{ + + EphyExitExtension *extension = EPHY_EXIT_EXTENSION (object); + + LOG ("EphyExitExtension finalising"); + + if (extension->priv->gconf_id != 0) + { + eel_gconf_notification_remove (extension->priv->gconf_id); + extension->priv->gconf_id = 0; + } + + if (extension->priv->session_filename) + { + g_free (extension->priv->session_filename); + extension->priv->session_filename = NULL; + } + + if (extension->priv->action_group) + { + g_object_unref (extension->priv->action_group); + extension->priv->action_group = NULL; + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +impl_attach_window (EphyExtension *ext, + EphyWindow *window) +{ + EphyExitExtension *extension = EPHY_EXIT_EXTENSION (ext); + WindowData *data; + GtkActionGroup *action_group; + guint merge_id; + GtkUIManager *manager; + + LOG ("EphyExitExtension attach_window"); + + manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); + + data = g_new (WindowData, 1); + + data->extension = extension; + extension->priv->action_group = action_group = + gtk_action_group_new ("EphyExitExtensionActions"); + gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); + gtk_action_group_add_actions (action_group, action_entries, + G_N_ELEMENTS (action_entries), + window); + gtk_ui_manager_insert_action_group (manager, action_group, -1); + + data->merge_id = merge_id = gtk_ui_manager_new_merge_id (manager); + gtk_ui_manager_add_ui (manager, merge_id, + "/menubar/FileMenu", + "FileQuit", "FileQuit", + GTK_UI_MANAGER_MENUITEM, FALSE); + + ephy_exit_extension_update_sensitivity (extension); + + g_object_set_data_full (G_OBJECT (window), WINDOW_DATA_KEY, data, + (GDestroyNotify) g_free); +} + +static void +impl_detach_window (EphyExtension *ext, + EphyWindow *window) +{ + LOG ("EphyExitExtension detach_window"); +} + +static void +impl_attach_tab (EphyExtension *ext, + EphyWindow *window, + EphyEmbed *embed) +{ + LOG ("attach_tab"); +} + +static void +impl_detach_tab (EphyExtension *ext, + EphyWindow *window, + EphyEmbed *embed) +{ + LOG ("detach_tab"); +} + +static void +ephy_exit_extension_iface_init (EphyExtensionIface *iface) +{ + iface->attach_window = impl_attach_window; + iface->detach_window = impl_detach_window; + iface->attach_tab = impl_attach_tab; + iface->detach_tab = impl_detach_tab; +} + +static void +ephy_exit_extension_class_init (EphyExitExtensionClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = ephy_exit_extension_finalize; + + g_type_class_add_private (object_class, sizeof (EphyExitExtensionPrivate)); +} + +GType +ephy_exit_extension_get_type (void) +{ + return type; +} + +GType +ephy_exit_extension_register_type (GTypeModule *module) +{ + const GTypeInfo our_info = + { + sizeof (EphyExitExtensionClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ephy_exit_extension_class_init, + NULL, + NULL, /* class_data */ + sizeof (EphyExitExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) ephy_exit_extension_init + }; + + const GInterfaceInfo extension_info = + { + (GInterfaceInitFunc) ephy_exit_extension_iface_init, + NULL, + NULL + }; + + type = g_type_module_register_type (module, + G_TYPE_OBJECT, + "EphyExitExtension", + &our_info, 0); + + g_type_module_add_interface (module, + type, + EPHY_TYPE_EXTENSION, + &extension_info); + + return type; +} Cambios de propiedades en extensions/exit/ephy-exit-extension.c ___________________________________________________________________ Nombre: svn:eol-style + native Index: extensions/exit/Makefile.am =================================================================== --- extensions/exit/Makefile.am (revisión: 0) +++ extensions/exit/Makefile.am (revisión: 0) @@ -0,0 +1,38 @@ +extensiondir = $(EXTENSIONS_DIR) +extension_LTLIBRARIES = libexitextension.la + +libexitextension_la_SOURCES = \ + ephy-exit-extension.c \ + ephy-exit-extension.h \ + extension.c + +libexitextension_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -DSHARE_DIR=\"$(pkgdatadir)\" \ + -DEPHY_EXTENSIONS_LOCALEDIR=\"$(datadir)/locale\" \ + $(AM_CPPFLAGS) + +libexitextension_la_CFLAGS = \ + $(EPIPHANY_DEPENDENCY_CFLAGS) \ + $(AM_CFLAGS) + +libexitextension_la_LDFLAGS = \ + -module -avoid-version \ + -export-symbols $(top_srcdir)/ephy-extension.symbols \ + $(AM_LDFLAGS) + +extensioninidir = $(extensiondir) +extensionini_in_files = exit.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) Index: extensions/exit/ephy-exit-extension.h =================================================================== --- extensions/exit/ephy-exit-extension.h (revisión: 0) +++ extensions/exit/ephy-exit-extension.h (revisión: 0) @@ -0,0 +1,60 @@ +/* + * Copyright © 2003 Marco Pesenti Gritti + * Copyright © 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-exit-extension.h 1376 2006-09-13 19:01:42Z chpe $ + */ + +#ifndef EPHY_EXIT_EXTENSION_H +#define EPHY_EXIT_EXTENSION_H + +#include +#include + +G_BEGIN_DECLS + +#define EPHY_TYPE_EXIT_EXTENSION (ephy_exit_extension_get_type ()) +#define EPHY_EXIT_EXTENSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EXIT_EXTENSION, EphyExitExtension)) +#define EPHY_EXIT_EXTENSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EXIT_EXTENSION, EphyExitExtensionClass)) +#define EPHY_IS_EXIT_EXTENSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EXIT_EXTENSION)) +#define EPHY_IS_EXIT_EXTENSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EXIT_EXTENSION)) +#define EPHY_EXIT_EXTENSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EXIT_EXTENSION, EphyExitExtensionClass)) + +typedef struct _EphyExitExtension EphyExitExtension; +typedef struct _EphyExitExtensionClass EphyExitExtensionClass; +typedef struct _EphyExitExtensionPrivate EphyExitExtensionPrivate; + +struct _EphyExitExtensionClass +{ + GObjectClass parent_class; +}; + +struct _EphyExitExtension +{ + GObject parent_instance; + + /*< private >*/ + EphyExitExtensionPrivate *priv; +}; + +GType ephy_exit_extension_get_type (void); + +GType ephy_exit_extension_register_type (GTypeModule *module); + +G_END_DECLS + +#endif Cambios de propiedades en extensions/exit/ephy-exit-extension.h ___________________________________________________________________ Nombre: svn:eol-style + native Index: extensions/exit/extension.c =================================================================== --- extensions/exit/extension.c (revisión: 0) +++ extensions/exit/extension.c (revisión: 0) @@ -0,0 +1,44 @@ +/* + * Copyright © 2003 Marco Pesenti Gritti + * Copyright © 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: extension.c 1634 2007-11-04 01:24:04Z cyrilbois $ + */ + +#include "config.h" + +#include "ephy-exit-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 EphyExitExtension"); + +#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_exit_extension_register_type (module); +} Cambios de propiedades en extensions/exit/extension.c ___________________________________________________________________ Nombre: svn:eol-style + native Index: configure.ac =================================================================== --- configure.ac (revisión: 1645) +++ configure.ac (copia de trabajo) @@ -161,7 +161,7 @@ AM_CONDITIONAL([HAVE_OPENSP],[test "x$en 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 exit 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" USEFUL_EXTENSIONS="actions adblock 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 adblock auto-scroller certificates error-viewer extensions-manager-ui gestures java-console page-info push-scroller select-stylesheet sidebar smart-bookmarks tab-groups tab-states" @@ -382,6 +382,7 @@ extensions/auto-scroller/Makefile extensions/certificates/Makefile extensions/cc-license-viewer/Makefile extensions/epilicious/Makefile +extensions/exit/Makefile extensions/gestures/Makefile extensions/error-viewer/Makefile extensions/error-viewer/mozilla/Makefile