--- ./browser-bookmarks-menu.py 2007/01/05 12:50:40 1.2 +++ ./browser-bookmarks-menu.py 2007/01/05 13:26:14 @@ -29,6 +29,12 @@ VERSION = "0.6" gnome_datadir = gnome.program_init(APP_NAME, VERSION).get_property(gnome.PARAM_GNOME_DATADIR) +ICON_NAME = "epiphany-bookmarks" +for location in [gnome_datadir + "/pixmaps", "/usr/share/epiphany/art"]: + try: + gtk.icon_theme_add_builtin_icon(ICON_NAME, gtk.ICON_SIZE_DIALOG, gtk.gdk.pixbuf_new_from_file_at_size("%s/%s.png" % (location, ICON_NAME), *gtk.icon_size_lookup(gtk.ICON_SIZE_DIALOG))) + except: + pass # We do not support "javascript:" URL bookmarks. global_unsupported_url_pattern = re.compile("^javascript:", re.IGNORECASE) @@ -506,14 +512,7 @@ def fill_root_menu(menu, info): (bookmarks_file, bookmarks_func, bookmarks_editor_text, bookmarks_editor_cmd, favicons_call) = info if bookmarks_editor_cmd is not None: menu_item = gtk.ImageMenuItem(bookmarks_editor_text) - # little hack to scale the PNG file to the menu item height - there - # is probably an easier (and more efficient) way to do this. - height = menu.render_icon(gtk.STOCK_CUT, gtk.ICON_SIZE_MENU).get_height() - image = gtk.Image() - image.set_from_file(gnome_datadir + "/pixmaps/epiphany-bookmarks.png") - pixbuf = image.get_pixbuf().scale_simple(height, height, gtk.gdk.INTERP_BILINEAR) - image.set_from_pixbuf(pixbuf) - # end of hack + image = gtk.image_new_from_icon_name(ICON_NAME, gtk.ICON_SIZE_MENU) menu_item.set_image(image) menu_item.connect("activate", run_command, bookmarks_editor_cmd) menu.append(menu_item) @@ -612,9 +611,6 @@ def on_applet_destroy(widget, arg): def on_about(component, verb, applet): - icon = gtk.Image() - icon.set_from_file(gnome_datadir + "/pixmaps/epiphany-bookmarks.png") - fullname = "Browser Bookmarks Menu" copyright = "Copyright (C) 2004-2005 Nigel Tao" description = "A menu for your web bookmarks." @@ -623,8 +619,8 @@ def on_about(component, verb, applet): "David Fritzsche", "Toshio Kuratomi", "Reinout van Schouwen", \ "Ricardo Veguilla", "Brett Viren",] - about = gnome.ui.About(fullname, VERSION, copyright, description, authors, None, None, icon.get_pixbuf()) - about.set_icon(icon.get_pixbuf()) + about = gnome.ui.About(fullname, VERSION, copyright, description, authors, None, None, gtk.icon_theme_get_default().load_icon(ICON_NAME, gtk.icon_size_lookup(gtk.ICON_SIZE_DIALOG)[0], 0)) + about.set_icon_name(ICON_NAME) about.show()