Software: Deskbar Firefox History Vai alla versione ITALIANA di questa pagina

GNOME 2.14 includes the new Deskbar applet, a very powerful tool that could be easily extended with plugins: soon after tried it, I thought that searching within the Firefox history.dat history file was something missing. I was usually launching internet addresses - when Firefox is closed - using the Run (ALT+F2) window; now the Deskbar applet with the following plugin is much more powerful, specially if you frequently launch often the same URLs.

To install it, copy & paste the lines of code below in ~/.gnome2/deskbar-applet/handlers/firefox_history.py

# Firefox history search plugin for the GNOME Deskbar applet
# Copyright (C) 2006 Flavio Gargiulo (FLAGAR.com)
#
# 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
# of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
from gettext import gettext as _
 
import gnomevfs
from deskbar.Handler import Handler
from deskbar.Match import Match
import glob, re, os
#import gtk, gtk.gdk
 
HANDLERS = {
        "FirefoxHistoryHandler" : {
                "name": _("Firefox History"),
                "description": _("Search URLs from the Firefox history"),
        }
}
 
class FirefoxHistoryMatch(Match):
        def __init__(self, backend, url=None, **args):
                Match.__init__(self, backend, **args)
                self.url = url
 
        def action(self, text=None):
                gnomevfs.url_show(self.url)
 
        def get_verb(self):
                return _("Firefox history: <b>%(name)s</b>")
 
        def get_hash(self, text=None):
                return self.url
 
 
class FirefoxHistoryHandler(Handler):
        def __init__(self):
                Handler.__init__(self, "firefox.png")
                self.ITEMS = {}
 
        def initialize(self):
                fhistorydat = open(glob.glob("%s/.mozilla/firefox/*.default/history.dat" % os.path.expanduser("~"))[0])
                fhistorycontents = fhistorydat.read()
                fhistorydat.close()
                self.fhistorycontents = re.findall(re.compile("\=http[0-9a-zA-Z\-\&\%\=\?\:\/\.]*\)"), fhistorycontents)
                self.load_items()
                self.ITEM_KEYS = self.ITEMS.keys()
                self.ITEM_KEYS.sort()
 
        def load_items(self, module=None, url=None):
                for x in self.fhistorycontents:
                        xn = x[(x.find('//')+2):-1]
                        xu = x[1:-1]
                        if self.ITEMS.has_key(xn):
                                self.ITEMS[x].append((xn, xu))
                        else:
                                self.ITEMS[x] = [(xn, xu)]
 
        def query(self, query):
                result = []
                query = query.lower()
                for k in self.ITEM_KEYS:
                        if k.find(query) != -1:
                                for name, url in self.ITEMS[k]:
                                        result.append(FirefoxHistoryMatch(self, name=name, url=url))
                return result
 
en/software/deskbar_firefox_history.txt · Ultima modifica: 15/04/2006 09:09
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki