[PATCH] Add "Tabs to Right" extension that sets GTK_POS_RIGHT on the tab notebook



This is a port of Rodney's tabs-left.py to C [0] which I have been using
for almost 3 years now. I had previously been using this feature in Opera.

I believe the right-hand version is superior as opening the first tab does
not move the actual browser pane, it simply resizes it.

 [0] http://rmjokers.blogspot.com/2006/11/dont-let-tabs-control-you.html

---
 AUTHORS                                            |    3 +
 configure.ac                                       |    7 +-
 extensions/tabs-right/Makefile.am                  |   38 +++++++
 extensions/tabs-right/ephy-tabs-right-extension.c  |  102 ++++++++++++++++
 extensions/tabs-right/ephy-tabs-right-extension.h  |   55 +++++++++++
 extensions/tabs-right/extension.c                  |   41 ++++++++
 .../tabs-right/tabs-right.ephy-extension.in.in     |   10 ++
 7 files changed, 253 insertions(+), 3 deletions(-)
 create mode 100644 extensions/tabs-right/Makefile.am
 create mode 100644 extensions/tabs-right/ephy-tabs-right-extension.c
 create mode 100644 extensions/tabs-right/ephy-tabs-right-extension.h
 create mode 100644 extensions/tabs-right/extension.c
 create mode 100644 extensions/tabs-right/tabs-right.ephy-extension.in.in


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby debian org
       `-
From f525a5103816ad652a480b9cc0928a406fb8ba61 Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby debian org>
Date: Sun, 11 Oct 2009 16:56:42 +0100
Subject: [PATCH] Add "Tabs to Right" extension that sets GTK_POS_RIGHT on the tab notebook

This is a port of Rodney's tabs-left.py to C [0] which I have been using
for almost 3 years now. I had previously been using this feature in Opera.

I believe the right-hand version is superior as opening the first tab does
not move the actual browser pane, it simply resizes it.

 [0] http://rmjokers.blogspot.com/2006/11/dont-let-tabs-control-you.html
---
 AUTHORS                                            |    3 +
 configure.ac                                       |    7 +-
 extensions/tabs-right/Makefile.am                  |   38 +++++++
 extensions/tabs-right/ephy-tabs-right-extension.c  |  102 ++++++++++++++++++++
 extensions/tabs-right/ephy-tabs-right-extension.h  |   55 +++++++++++
 extensions/tabs-right/extension.c                  |   41 ++++++++
 .../tabs-right/tabs-right.ephy-extension.in.in     |   10 ++
 7 files changed, 253 insertions(+), 3 deletions(-)
 create mode 100644 extensions/tabs-right/Makefile.am
 create mode 100644 extensions/tabs-right/ephy-tabs-right-extension.c
 create mode 100644 extensions/tabs-right/ephy-tabs-right-extension.h
 create mode 100644 extensions/tabs-right/extension.c
 create mode 100644 extensions/tabs-right/tabs-right.ephy-extension.in.in

diff --git a/AUTHORS b/AUTHORS
index bb5e6a6..5ac1e0f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -21,6 +21,9 @@ Dashboard:
 Tab Grouper:
 	Justin Wake <jwake iinet net au>
 
+Tabs to Right:
+	Chris Lamb <lamby debian org>
+
 Smart Bookmarks:
 Net Monitor:
 	Jean-François Rameau <jf rameau wanadoo fr>
diff --git a/configure.ac b/configure.ac
index 6348370..e55da7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,9 +171,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 java-console livehttpheaders page-info permissions push-scroller rss sample select-stylesheet sidebar smart-bookmarks soup-fly tab-groups tab-states"
-USEFUL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-states"
-DEFAULT_EXTENSIONS="actions adblock auto-scroller certificates error-viewer extensions-manager-ui java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-states greasemonkey"
+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 select-stylesheet sidebar smart-bookmarks soup-fly tab-groups tab-states tabs-right"
+USEFUL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-states tabs-right"
+DEFAULT_EXTENSIONS="actions adblock auto-scroller certificates error-viewer extensions-manager-ui java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-states greasemonkey tabs-right"
 
 MOZILLA_ALL_EXTENSIONS="error-viewer java-console livehttpheaders page-info select-stylesheet smart-bookmarks"
 
@@ -320,6 +320,7 @@ extensions/smart-bookmarks/mozilla/Makefile
 extensions/soup-fly/Makefile
 extensions/tab-states/Makefile
 extensions/tab-groups/Makefile
+extensions/tabs-right/Makefile
 extensions/java-console/Makefile
 extensions/java-console/mozilla/Makefile
 help/Makefile
diff --git a/extensions/tabs-right/Makefile.am b/extensions/tabs-right/Makefile.am
new file mode 100644
index 0000000..1dccdd0
--- /dev/null
+++ b/extensions/tabs-right/Makefile.am
@@ -0,0 +1,38 @@
+extensiondir = $(EXTENSIONS_DIR)
+extension_LTLIBRARIES = libtabsrightextension.la
+
+libtabsrightextension_la_SOURCES = \
+	ephy-tabs-right-extension.c	\
+	ephy-tabs-right-extension.h	\
+	extension.c
+
+libtabsrightextension_la_CPPFLAGS = \
+        -I$(top_srcdir)/include				\
+	-DSHARE_DIR=\"$(pkgdatadir)\"			\
+	-DEPHY_EXTENSIONS_LOCALEDIR=\"$(datadir)/locale\"  \
+	$(AM_CPPFLAGS)
+
+libtabsrightextension_la_CFLAGS = \
+	$(EPIPHANY_DEPENDENCY_CFLAGS)	\
+	$(AM_CFLAGS)
+
+libtabsrightextension_la_LDFLAGS = \
+	-module -avoid-version \
+	-export-symbols $(top_srcdir)/ephy-extension.symbols \
+	$(AM_LDFLAGS)
+
+extensioninidir = $(extensiondir)
+extensionini_in_files = tabs-right.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/tabs-right/ephy-tabs-right-extension.c b/extensions/tabs-right/ephy-tabs-right-extension.c
new file mode 100644
index 0000000..ecb99ac
--- /dev/null
+++ b/extensions/tabs-right/ephy-tabs-right-extension.c
@@ -0,0 +1,102 @@
+/*
+ *  Copyright © 2009 Chris Lamb <lamby debian org>
+ *
+ *  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-tabs-right-extension.h"
+#include "ephy-debug.h"
+
+#include <epiphany/epiphany.h>
+
+#include <gmodule.h>
+#include <gtk/gtk.h>
+
+static GObjectClass *parent_class = NULL;
+
+static GType type = 0;
+
+static void
+impl_attach_window (EphyExtension *ext,
+		    EphyWindow *window)
+{
+	GtkWidget *notebook;
+
+	notebook = ephy_window_get_notebook (window);
+	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_RIGHT);
+}
+
+static void
+impl_detach_window (EphyExtension *ext,
+		    EphyWindow *window)
+{
+	GtkWidget *notebook;
+
+	notebook = ephy_window_get_notebook (window);
+	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
+}
+
+static void
+ephy_tabs_right_extension_iface_init (EphyExtensionIface *iface)
+{
+	iface->attach_window = impl_attach_window;
+	iface->detach_window = impl_detach_window;
+}
+
+GType
+ephy_tabs_right_extension_get_type (void)
+{
+	return type;
+}
+
+GType
+ephy_tabs_right_extension_register_type (GTypeModule *module)
+{
+	const GTypeInfo our_info =
+	{
+		sizeof (EphyTabsRightExtensionClass),
+		NULL, /* base_init */
+		NULL, /* base_finalize */
+		NULL, /* class_init */
+		NULL,
+		NULL, /* class_data */
+		sizeof (EphyTabsRightExtension),
+		0, /* n_preallocs */
+		NULL /* instance_init */
+	};
+
+	const GInterfaceInfo extension_info =
+	{
+		(GInterfaceInitFunc) ephy_tabs_right_extension_iface_init,
+		NULL,
+		NULL
+	};
+
+	type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "EphyTabsRightExtension",
+					    &our_info, 0);
+
+	g_type_module_add_interface (module,
+				     type,
+				     EPHY_TYPE_EXTENSION,
+				     &extension_info);
+
+	return type;
+}
diff --git a/extensions/tabs-right/ephy-tabs-right-extension.h b/extensions/tabs-right/ephy-tabs-right-extension.h
new file mode 100644
index 0000000..dd6f81f
--- /dev/null
+++ b/extensions/tabs-right/ephy-tabs-right-extension.h
@@ -0,0 +1,55 @@
+/*
+ *  Copyright © 2009 Chris Lamb <lamby debian org>
+ *
+ *  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_TABS_RIGHT_EXTENSION_H
+#define EPHY_TABS_RIGHT_EXTENSION_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_TABS_RIGHT_EXTENSION		(ephy_tabs_right_extension_get_type ())
+#define EPHY_TABS_RIGHT_EXTENSION(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TABS_RIGHT_EXTENSION, EphyTabsRightExtension))
+#define EPHY_TABS_RIGHT_EXTENSION_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TABS_RIGHT_EXTENSION, EphyTabsRightExtensionClass))
+#define EPHY_IS_TABS_RIGHT_EXTENSION(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TABS_RIGHT_EXTENSION))
+#define EPHY_IS_TABS_RIGHT_EXTENSION_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TABS_RIGHT_EXTENSION))
+#define EPHY_TABS_RIGHT_EXTENSION_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TABS_RIGHT_EXTENSION, EphyTabsRightExtensionClass))
+
+typedef struct _EphyTabsRightExtension		EphyTabsRightExtension;
+typedef struct _EphyTabsRightExtensionClass	EphyTabsRightExtensionClass;
+
+struct _EphyTabsRightExtensionClass
+{
+	GObjectClass parent_class;
+};
+
+struct _EphyTabsRightExtension
+{
+	GObject parent_instance;
+};
+
+GType	ephy_tabs_right_extension_get_type		(void);
+
+GType	ephy_tabs_right_extension_register_type	(GTypeModule *module);
+
+G_END_DECLS
+
+#endif
diff --git a/extensions/tabs-right/extension.c b/extensions/tabs-right/extension.c
new file mode 100644
index 0000000..120139f
--- /dev/null
+++ b/extensions/tabs-right/extension.c
@@ -0,0 +1,41 @@
+/*
+ *  Copyright © 2009 Chris Lamb <lamby debian org>
+ *
+ *  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-tabs-right-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)
+{
+#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_tabs_right_extension_register_type (module);
+}
diff --git a/extensions/tabs-right/tabs-right.ephy-extension.in.in b/extensions/tabs-right/tabs-right.ephy-extension.in.in
new file mode 100644
index 0000000..5a36033
--- /dev/null
+++ b/extensions/tabs-right/tabs-right.ephy-extension.in.in
@@ -0,0 +1,10 @@
+[Epiphany Extension]
+_Name=Tabs to Right
+_Description=Moves the browser tabs to the right side of the window.
+Authors=Chris Lamb <lamby debian org>
+Version=1
+URL=http://www.gnome.org/projects/epiphany/extensions.html
+
+[Loader]
+Type=shlib
+Library=%EXTENSION_DIR%/%LIBRARY%
-- 
1.6.4.3

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]