/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Jelmer Vernooij
  • Date: 2008-03-30 15:58:52 UTC
  • mto: (450.1.11 trunk)
  • mto: This revision was merged to the branch mainline in revision 458.
  • Revision ID: jelmer@samba.org-20080330155852-0btngt3srvde5pj9
Add utility function for finding icon paths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
    return os.path.dirname(__file__)
110
110
 
111
111
 
 
112
def icon_path(*args):
 
113
    basedirs = [os.path.join(data_path()),
 
114
             "/usr/share/bzr-gtk", 
 
115
             "/usr/local/share/bzr-gtk"]
 
116
    for basedir in basedirs:
 
117
        path = os.path.join(basedir, 'icons', *args)
 
118
        if os.path.exists(path):
 
119
            return path
 
120
    return None
 
121
 
 
122
 
112
123
class GTKCommand(Command):
113
124
    """Abstract class providing GTK specific run commands."""
114
125
 
516
527
        from notify import NotifyPopupMenu
517
528
        gtk = self.open_display()
518
529
        menu = NotifyPopupMenu()
519
 
        icon = gtk.status_icon_new_from_file(os.path.join(data_path(), "bzr-icon-64.png"))
 
530
        icon = gtk.status_icon_new_from_file(icon_path("bzr-icon-64.png"))
520
531
        icon.connect('popup-menu', menu.display)
521
532
 
522
533
        import cgi