~jconti/recent-notifications/trunk

52 by Jason Conti
Adding several new icons for notification levels, and replaced the indicator icons with new ones. Also adding Icon.py because I apparently forgot in the last commit.
1
"""
2
Icon.py
3
by Jason Conti
4
February 22, 2010
5
6
Utility functions for working with icons.
7
"""
8
9
import gtk
10
11
def load_icon(name, size = 48):
12
  """Loads an icon from the default icon theme."""
13
  try:
14
    theme = gtk.icon_theme_get_default()
15
    return theme.load_icon(name, size, gtk.ICON_LOOKUP_FORCE_SVG)
16
  except:
17
    return None
18
19
def load_icon_from_file(path, size = 48):
20
  """Loads an icon from the given path."""
21
  try:
22
    return gtk.gdk.pixbuf_new_from_file_at_size(path, size, size)
23
  except:
24
    return None
25
26
27