[kupfer] preferences: Say that a Source is visible as an Application



commit e0b69578c8fb945e5f655ecab498055c95d8739f
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sun Jan 3 19:49:18 2010 +0100

    preferences: Say that a Source is visible as an Application
    
    If a Source has a leaf repr, which is how it is shown in the catalog,
    show this in the preferences information about the plugin. Display a
    small information line like "Content of Firefox" just below the
    catalog.

 kupfer/preferences.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/preferences.py b/kupfer/preferences.py
index 7de1c75..63c02ed 100644
--- a/kupfer/preferences.py
+++ b/kupfer/preferences.py
@@ -343,6 +343,7 @@ class PreferencesWindowController (pretty.OutputMixin):
 		all_items = list()
 		vbox = gtk.VBox()
 		vbox.set_property("spacing", 5)
+
 		def make_objects_frame(objs, title):
 			frame_label = gtk.Label()
 			frame_label.set_markup(u"<b>%s</b>" % title)
@@ -371,6 +372,25 @@ class PreferencesWindowController (pretty.OutputMixin):
 				label.set_markup(name_label)
 				hbox.pack_start(label, False)
 				objvbox.pack_start(hbox)
+				# Display information for application content-sources.
+				try:
+					leaf_repr = obj.get_leaf_repr()
+				except AttributeError:
+					continue
+				if leaf_repr is None:
+					continue
+				if hasattr(leaf_repr, "is_valid") and not leaf_repr.is_valid():
+					continue
+				hbox = gtk.HBox()
+				hbox.set_property("spacing", 3)
+				gicon = leaf_repr.get_icon()
+				im = gtk.Image()
+				im.set_property("gicon", gicon)
+				im.set_property("pixel-size", 16)
+				hbox.pack_start(gtk.Label(_("Content of")), False)
+				hbox.pack_start(im, False)
+				hbox.pack_start(gtk.Label(unicode(leaf_repr)), False)
+				objvbox.pack_start(hbox)
 			return objvbox
 
 		sources = list(sources or ()) + list(text_sources or ())



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]