beagle r4647 - in trunk/beagle: . epiphany-extension
- From: arunsr svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4647 - in trunk/beagle: . epiphany-extension
- Date: Mon, 31 Mar 2008 10:21:07 +0100 (BST)
Author: arunsr
Date: Mon Mar 31 10:21:07 2008
New Revision: 4647
URL: http://svn.gnome.org/viewvc/beagle?rev=4647&view=rev
Log:
Merge the pre-Epiphany-2.22 and Epiphany-2.22+ extensions.
This cleans up the previous fugly commit, since most of the code was the same.
We get the Epiphany version at "configure" time, not runtime, which is
suboptimal, but there doesn't seem to be a runtime way to do it.
Removed:
trunk/beagle/epiphany-extension/beagle-2.22.py.in
Modified:
trunk/beagle/configure.in
trunk/beagle/epiphany-extension/Makefile.am
trunk/beagle/epiphany-extension/beagle.py.in
Modified: trunk/beagle/configure.in
==============================================================================
--- trunk/beagle/configure.in (original)
+++ trunk/beagle/configure.in Mon Mar 31 10:21:07 2008
@@ -432,11 +432,6 @@
if test "x$found_ephy" = "xyes"; then
EPIPHANY_MAJOR=$v
AC_MSG_RESULT([yes])
-
- if test "x$v" = "x2.22"; then
- use_new_epiphany_extension=yes
- fi
-
break
else
AC_MSG_RESULT([no])
@@ -460,7 +455,7 @@
fi
AM_CONDITIONAL(ENABLE_EPIPHANY_EXTENSION, test "x$enable_epiphany_extension" = "xyes")
-AM_CONDITIONAL(USE_NEW_EPIPHANY_EXTENSION, test "x$use_new_epiphany_extension" = "xyes")
+AC_SUBST(EPIPHANY_MAJOR)
# distcheck hack
AC_ARG_ENABLE([epiphany-extension-install],
Modified: trunk/beagle/epiphany-extension/Makefile.am
==============================================================================
--- trunk/beagle/epiphany-extension/Makefile.am (original)
+++ trunk/beagle/epiphany-extension/Makefile.am Mon Mar 31 10:21:07 2008
@@ -3,15 +3,12 @@
extension_in_files = beagle.ephy-extension.in
extension_files = $(extension_in_files:.ephy-extension.in=.ephy-extension)
-if USE_NEW_EPIPHANY_EXTENSION
-BEAGLE_PY_IN = beagle-2.22.py.in
-else
BEAGLE_PY_IN = beagle.py.in
-endif
beagle.py: $(BEAGLE_PY_IN)
sed \
-e "s|\ localedir\@|${localedir}|g" \
+ -e "s|\ EPIPHANY_MAJOR\@|${EPIPHANY_MAJOR}|g" \
< $(srcdir)/$(BEAGLE_PY_IN) > beagle.py
# Hack to fix distcheck
@@ -23,6 +20,6 @@
extension_DATA = $(extension_files) beagle.py
endif
-EXTRA_DIST = $(extension_in_files) beagle.py.in beagle-2.22.py.in
+EXTRA_DIST = $(extension_in_files) beagle.py.in
CLEANFILES = $(extension_DATA)
Modified: trunk/beagle/epiphany-extension/beagle.py.in
==============================================================================
--- trunk/beagle/epiphany-extension/beagle.py.in (original)
+++ trunk/beagle/epiphany-extension/beagle.py.in Mon Mar 31 10:21:07 2008
@@ -35,6 +35,7 @@
#these are constant
beagle_data_path = os.environ["HOME"] + "/.beagle/ToIndex/"
config_file_path = os.environ["HOME"] + "/.gnome2/epiphany/extensions/beagleIndexer.conf"
+epiphany_version = @EPIPHANY_MAJOR@
#The following is about config
class Config(dict):
@@ -136,13 +137,17 @@
# we use window.get_active_tab(): we want the menu entries to reflect the active
-# tab, not necessarily the one which fired a signal.
+# tab, not necessarily the one which fired a signal. For Epiphany >= 2.22, we
+# need to use window.get_active_child()
def _update_action(window):
'''update action for PyBeagleExtIndexThisPage (enabe after page loaded)'''
index_this_page_action = window.get_ui_manager().get_action('/menubar/ToolsMenu/BeagleMenu/PyBeagleExtIndexThisPage')
- tab = window.get_active_tab()
+ if (epiphany_version < 2.22):
+ child = window.get_active_tab()
+ else:
+ child = window.get_active_child()
# Tab is None when a window is first opened
- sensitive = (tab != None and tab.get_load_status() != True)
+ sensitive = (child != None and child.get_load_status() != True)
index_this_page_action.set_sensitive(sensitive)
def _switch_page_cb(notebook, page, page_num, window):
@@ -151,8 +156,13 @@
def _index_this_page_cb(action, window):
'''callback for index_this_page action'''
- tab = window.get_active_tab()
- embed = tab.get_embed()
+ if epiphany_version < 2.22:
+ tab = window.get_active_tab()
+ embed = tab.get_embed()
+ else:
+ tab = None
+ embed = window.get_active_child()
+
index_embed(tab, embed, True)
set_status_label(window, _("beagle is indexing %s") % embed.get_location(True))
@@ -177,7 +187,7 @@
set_status_label(window, _("beagle is indexing link %s") % value)
pass
-def _load_status_cb(tab, event, window):
+def _load_status_cb(child, event, window):
'''
Callback for load_status chanage
the load_status == false means the page is loaded.
@@ -188,8 +198,13 @@
print "Auto Index is turned off. No index "
return
#page is loaded
- if tab != None and tab.get_load_status() != True:
- embed = tab.get_embed()
+ if child != None and child.get_load_status() != True:
+ if (epiphany_version < 2.22):
+ tab = child;
+ embed = tab.get_embed()
+ else:
+ tab = None
+ embed = child
url = embed.get_location(True)
if should_index(url) == False:
print "%s will NOT be indexed." % url
@@ -368,7 +383,10 @@
'''get mata data from embed "'''
#guess content type here
content_type = ""
- doc_type = tab.get_document_type()
+ if (epiphany_version < 2.22):
+ doc_type = tab.get_document_type()
+ else:
+ doc_type = embed.get_document_type()
if doc_type == epiphany.EMBED_DOCUMENT_HTML:
content_type = "text/html"
elif doc_type == epiphany.EMBED_DOCUMENT_XML:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]