Generic window icon function

I made a function to set the window icon, rather than doing it only when
the window is constructed.
This commit is contained in:
Bryan Schumaker 2010-10-30 13:09:15 -04:00
parent 1136e3f4af
commit 3de6e94db1
3 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,7 @@ prefs = libsaria.prefs
win = ocarina.get_window(prefs["window_size"])
ocarina.set_window_title(ocarina.__vers__)
ocarina.set_window_icon("images/ocarina.png")
ocarina.add_tab("Playlist", collection.Playlist())
ocarina.add_tab("Library", collection.Library())

View File

@ -79,3 +79,8 @@ get_window = get_window_once
def set_window_title(text):
window = get_window()
window.set_title(text)
def set_window_icon(path):
if libsaria.path.exists(path):
window = get_window()
window.set_icon_from_file(path)

View File

@ -31,7 +31,6 @@ def init(size):
mask = gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP
dnd_list = [("text/uri-list", 0, TARGET_TYPE_URI_LIST)]
window.drag_dest_set(mask, dnd_list, gtk.gdk.ACTION_COPY)
window.set_icon_from_file("images/ocarina.png")
window.resize(size[0], size[1])
window.show()