[epiphany-extensions] Initial version of Tab Key Tab Navigate extension
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany-extensions] Initial version of Tab Key Tab Navigate extension
- Date: Sat, 20 Feb 2010 01:48:47 +0000 (UTC)
commit 50abbe20ea7662e7dbc885b9c5821fba227d35b3
Author: LubomÃr SedláÅ? <lubomir sedlar gmail com>
Date: Tue Feb 16 13:43:41 2010 +0100
Initial version of Tab Key Tab Navigate extension
Bug #607359
Signed-off-by: Diego Escalante Urrelo <descalante igalia com>
configure.ac | 7 +-
extensions/tab-key-tab-navigate/Makefile.am | 38 +++++
.../ephy-tab-key-tab-navigate-extension.c | 151 ++++++++++++++++++++
.../ephy-tab-key-tab-navigate-extension.h | 56 +++++++
extensions/tab-key-tab-navigate/extension.c | 44 ++++++
.../tab-key-tab-navigate.ephy-extension.in.in | 11 ++
po/POTFILES.in | 1 +
7 files changed, 305 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e4e2841..90de71d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,9 +170,9 @@ AM_CONDITIONAL([HAVE_OPENSP],[test "x$enable_opensp" = "xyes"])
AC_MSG_CHECKING([which extensions to build])
-ALL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures greasemonkey html5tube java-console livehttpheaders page-info permissions push-scroller rss sample select-stylesheet smart-bookmarks soup-fly tab-groups tab-states"
-USEFUL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates extensions-manager-ui html5tube java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-states"
-DEFAULT_EXTENSIONS="actions adblock auto-reload auto-scroller certificates extensions-manager-ui greasemonkey gestures html5tube push-scroller soup-fly tab-groups tab-states rss"
+ALL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures greasemonkey html5tube java-console livehttpheaders page-info permissions push-scroller rss sample select-stylesheet smart-bookmarks soup-fly tab-groups tab-key-tab-navigate tab-states"
+USEFUL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates extensions-manager-ui html5tube java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-key-tab-navigate tab-states"
+DEFAULT_EXTENSIONS="actions adblock auto-reload auto-scroller certificates extensions-manager-ui greasemonkey gestures html5tube push-scroller soup-fly tab-groups tab-key-tab-navigate tab-states rss"
MOZILLA_ALL_EXTENSIONS="error-viewer java-console livehttpheaders page-info select-stylesheet smart-bookmarks"
@@ -300,6 +300,7 @@ extensions/select-stylesheet/mozilla/Makefile
extensions/smart-bookmarks/Makefile
extensions/smart-bookmarks/mozilla/Makefile
extensions/soup-fly/Makefile
+extensions/tab-key-tab-navigate/Makefile
extensions/tab-states/Makefile
extensions/tab-groups/Makefile
extensions/java-console/Makefile
diff --git a/extensions/tab-key-tab-navigate/Makefile.am b/extensions/tab-key-tab-navigate/Makefile.am
new file mode 100644
index 0000000..158fd83
--- /dev/null
+++ b/extensions/tab-key-tab-navigate/Makefile.am
@@ -0,0 +1,38 @@
+extensiondir = $(EXTENSIONS_DIR)
+extension_LTLIBRARIES = libtabkeytabnavigateextension.la
+
+libtabkeytabnavigateextension_la_SOURCES = \
+ ephy-tab-key-tab-navigate-extension.c \
+ ephy-tab-key-tab-navigate-extension.h \
+ extension.c
+
+libtabkeytabnavigateextension_la_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -DSHARE_DIR=\"$(pkgdatadir)\" \
+ -DEPHY_EXTENSIONS_LOCALEDIR=\"$(datadir)/locale\" \
+ $(AM_CPPFLAGS)
+
+libtabkeytabnavigateextension_la_CFLAGS = \
+ $(EPIPHANY_DEPENDENCY_CFLAGS) \
+ $(AM_CFLAGS)
+
+libtabkeytabnavigateextension_la_LDFLAGS = \
+ -module -avoid-version \
+ -export-symbols $(top_srcdir)/ephy-extension.symbols \
+ $(AM_LDFLAGS)
+
+extensioninidir = $(extensiondir)
+extensionini_in_files = tab-key-tab-navigate.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 --git a/extensions/tab-key-tab-navigate/ephy-tab-key-tab-navigate-extension.c b/extensions/tab-key-tab-navigate/ephy-tab-key-tab-navigate-extension.c
new file mode 100644
index 0000000..e029f6c
--- /dev/null
+++ b/extensions/tab-key-tab-navigate/ephy-tab-key-tab-navigate-extension.c
@@ -0,0 +1,151 @@
+/*
+ * 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$
+ */
+
+#include "config.h"
+
+#include "ephy-tab-key-tab-navigate-extension.h"
+#include "ephy-debug.h"
+
+#include <epiphany/epiphany.h>
+#include <gdk/gdkkeysyms.h>
+
+#include <gmodule.h>
+
+static GObjectClass *parent_class = NULL;
+
+static GType type = 0;
+
+static void set_tab_offset (EphyWindow *window, gint offset)
+{
+ GtkWidget *notebook;
+ gint index, count, new_index;
+
+ notebook = ephy_window_get_notebook (window);
+ index = gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook));
+ count = gtk_notebook_get_n_pages (GTK_NOTEBOOK(notebook));
+ new_index = (index + offset) % count;
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), new_index);
+}
+
+static gboolean key_press_cb (EphyWindow *window, GdkEventKey *event, gpointer data)
+{
+ if (event->state & GDK_CONTROL_MASK) {
+ if (event->keyval == GDK_Tab) {
+ set_tab_offset (window, 1);
+ } else if (event->keyval == GDK_ISO_Left_Tab) {
+ set_tab_offset (window, -1);
+ } else {
+ return FALSE;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+ephy_tab_key_tab_navigate_extension_init (EphyTabKeyTabNavigateExtension *extension)
+{
+ LOG ("EphyTabKeyTabNavigateExtension initialising");
+}
+
+static void
+ephy_tab_key_tab_navigate_extension_finalize (GObject *object)
+{
+ LOG ("EphyTabKeyTabNavigateExtension finalising");
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+impl_attach_window (EphyExtension *ext,
+ EphyWindow *window)
+{
+ LOG ("EphyTabKeyTabNavigateExtension attach_window");
+ g_signal_connect (GTK_WIDGET(window), "key-press-event", G_CALLBACK (key_press_cb), NULL);
+}
+
+static void
+impl_detach_window (EphyExtension *ext,
+ EphyWindow *window)
+{
+ LOG ("EphyTabKeyTabNavigateExtension detach_window");
+ g_signal_handlers_disconnect_by_func (GTK_WIDGET(window), G_CALLBACK (key_press_cb), NULL);
+}
+
+static void
+ephy_tab_key_tab_navigate_extension_iface_init (EphyExtensionIface *iface)
+{
+ iface->attach_window = impl_attach_window;
+ iface->detach_window = impl_detach_window;
+}
+
+static void
+ephy_tab_key_tab_navigate_extension_class_init (EphyTabKeyTabNavigateExtensionClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_tab_key_tab_navigate_extension_finalize;
+}
+
+GType
+ephy_tab_key_tab_navigate_extension_get_type (void)
+{
+ return type;
+}
+
+GType
+ephy_tab_key_tab_navigate_extension_register_type (GTypeModule *module)
+{
+ const GTypeInfo our_info =
+ {
+ sizeof (EphyTabKeyTabNavigateExtensionClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_tab_key_tab_navigate_extension_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (EphyTabKeyTabNavigateExtension),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_tab_key_tab_navigate_extension_init
+ };
+
+ const GInterfaceInfo extension_info =
+ {
+ (GInterfaceInitFunc) ephy_tab_key_tab_navigate_extension_iface_init,
+ NULL,
+ NULL
+ };
+
+ type = g_type_module_register_type (module,
+ G_TYPE_OBJECT,
+ "EphyTabKeyTabNavigateExtension",
+ &our_info, 0);
+
+ g_type_module_add_interface (module,
+ type,
+ EPHY_TYPE_EXTENSION,
+ &extension_info);
+
+ return type;
+}
diff --git a/extensions/tab-key-tab-navigate/ephy-tab-key-tab-navigate-extension.h b/extensions/tab-key-tab-navigate/ephy-tab-key-tab-navigate-extension.h
new file mode 100644
index 0000000..e905198
--- /dev/null
+++ b/extensions/tab-key-tab-navigate/ephy-tab-key-tab-navigate-extension.h
@@ -0,0 +1,56 @@
+/*
+ * 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$
+ */
+
+#ifndef EPHY_TAB_KEY_TAB_NAVIGATE_EXTENSION_H
+#define EPHY_TAB_KEY_TAB_NAVIGATE_EXTENSION_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_TAB_KEY_TAB_NAVIGATE_EXTENSION (ephy_tab_key_tab_navigate_extension_get_type ())
+#define EPHY_TAB_KEY_TAB_NAVIGATE_EXTENSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TAB_KEY_TAB_NAVIGATE_EXTENSION, EphyTabKeyTabNavigateExtension))
+#define EPHY_TAB_KEY_TAB_NAVIGATE_EXTENSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TAB_KEY_TAB_NAVIGATE_EXTENSION, EphyTabKeyTabNavigateExtensionClass))
+#define EPHY_IS_TAB_KEY_TAB_NAVIGATE_EXTENSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TAB_KEY_TAB_NAVIGATE_EXTENSION))
+#define EPHY_IS_TAB_KEY_TAB_NAVIGATE_EXTENSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TAB_KEY_TAB_NAVIGATE_EXTENSION))
+#define EPHY_TAB_KEY_TAB_NAVIGATE_EXTENSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TAB_KEY_TAB_NAVIGATE_EXTENSION, EphyTabKeyTabNavigateExtensionClass))
+
+typedef struct _EphyTabKeyTabNavigateExtension EphyTabKeyTabNavigateExtension;
+typedef struct _EphyTabKeyTabNavigateExtensionClass EphyTabKeyTabNavigateExtensionClass;
+
+struct _EphyTabKeyTabNavigateExtensionClass
+{
+ GObjectClass parent_class;
+};
+
+struct _EphyTabKeyTabNavigateExtension
+{
+ GObject parent_instance;
+};
+
+GType ephy_tab_key_tab_navigate_extension_get_type (void);
+
+GType ephy_tab_key_tab_navigate_extension_register_type (GTypeModule *module);
+
+G_END_DECLS
+
+#endif
diff --git a/extensions/tab-key-tab-navigate/extension.c b/extensions/tab-key-tab-navigate/extension.c
new file mode 100644
index 0000000..9c95eea
--- /dev/null
+++ b/extensions/tab-key-tab-navigate/extension.c
@@ -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$
+ */
+
+#include "config.h"
+
+#include "ephy-tab-key-tab-navigate-extension.h"
+#include "ephy-debug.h"
+
+#include <glib/gi18n-lib.h>
+#include <gmodule.h>
+
+G_MODULE_EXPORT GType register_module (GTypeModule *module);
+
+G_MODULE_EXPORT GType
+register_module (GTypeModule *module)
+{
+ LOG ("Registering EphyTabKeyTabNavigateExtension");
+
+#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_tab_key_tab_navigate_extension_register_type (module);
+}
diff --git a/extensions/tab-key-tab-navigate/tab-key-tab-navigate.ephy-extension.in.in b/extensions/tab-key-tab-navigate/tab-key-tab-navigate.ephy-extension.in.in
new file mode 100644
index 0000000..c0e414d
--- /dev/null
+++ b/extensions/tab-key-tab-navigate/tab-key-tab-navigate.ephy-extension.in.in
@@ -0,0 +1,11 @@
+[Epiphany Extension]
+_Name=Tab Key Tab Navigate
+_Description=Use the Tab key to navigate between tabs
+Authors=LubomÃr SedláÅ? <lubomir sedlar gmail com>, Stefan Stuhr
+Version=1
+URL=http://www.gnome.org/projects/epiphany/extensions.html
+
+
+[Loader]
+Type=shlib
+Library=%EXTENSION_DIR%/%LIBRARY%
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1f41876..f3f1fd7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -59,3 +59,4 @@ extensions/soup-fly/soup-fly.c
[type: gettext/ini]extensions/smart-bookmarks/smart-bookmarks.ephy-extension.in.in
[type: gettext/ini]extensions/tab-groups/tab-groups.ephy-extension.in.in
[type: gettext/ini]extensions/tab-states/tab-states.ephy-extension.in.in
+[type: gettext/ini]extensions/tab-key-tab-navigate/tab-key-tab-navigate.ephy-extension.in.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]