add progress indicator

This commit is contained in:
josch 2012-02-29 14:20:09 +01:00
parent 281ed383f5
commit 5b5f9eeeec

View file

@ -146,7 +146,8 @@ class TabLabel(Gtk.HBox):
class ContentPane (Gtk.Notebook): class ContentPane (Gtk.Notebook):
__gsignals__ = { __gsignals__ = {
"focus-view-title-changed": (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, (GObject.TYPE_OBJECT, GObject.TYPE_STRING,)) "focus-view-title-changed": (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, (GObject.TYPE_OBJECT, GObject.TYPE_STRING,)),
"progress-changed": (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, (GObject.TYPE_FLOAT,))
} }
def __init__ (self): def __init__ (self):
@ -269,6 +270,10 @@ class ContentPane (Gtk.Notebook):
self.emit("focus-view-title-changed", frame, title) self.emit("focus-view-title-changed", frame, title)
web_view.connect("title-changed", _title_changed_cb) web_view.connect("title-changed", _title_changed_cb)
def _progress_changed_cb(view, progress):
self.emit("progress-changed", view.get_progress())
web_view.connect("notify::progress", _progress_changed_cb)
scrolled_window = Gtk.ScrolledWindow() scrolled_window = Gtk.ScrolledWindow()
scrolled_window.props.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC scrolled_window.props.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC
scrolled_window.props.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC scrolled_window.props.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC
@ -392,6 +397,9 @@ class WebToolbar(Gtk.Toolbar):
def location_set_text (self, text): def location_set_text (self, text):
self._entry.set_text(text) self._entry.set_text(text)
def location_set_progress(self, progress):
self._entry.set_progress_fraction(progress%1)
class EntryTree(Gtk.TreeView): class EntryTree(Gtk.TreeView):
__gsignals__ = { __gsignals__ = {
@ -890,6 +898,10 @@ class FeedReaderWindow(Gtk.Window):
toolbar.location_set_text(uri) toolbar.location_set_text(uri)
content_pane.connect("focus-view-title-changed", title_changed_cb) content_pane.connect("focus-view-title-changed", title_changed_cb)
def progress_changed_cb(pane, progress):
toolbar.location_set_progress(progress)
content_pane.connect("progress-changed", progress_changed_cb)
entries = EntryTree(config, feeddb) entries = EntryTree(config, feeddb)
def item_selected_cb(entry, feedurl, item): def item_selected_cb(entry, feedurl, item):