First go at progress in the entry.

This commit is contained in:
Marco Pesenti Gritti
2006-10-12 15:49:11 +02:00
parent 62a46ff92b
commit 3cfa9c40bd
14 changed files with 815 additions and 15 deletions
+8 -1
View File
@@ -1,6 +1,8 @@
import gobject
import gtk
from _sugar import AddressEntry
class AddressItem(gtk.ToolItem):
__gsignals__ = {
'open-address': (gobject.SIGNAL_RUN_FIRST,
@@ -10,12 +12,17 @@ class AddressItem(gtk.ToolItem):
def __init__(self):
gtk.ToolItem.__init__(self)
entry = gtk.Entry()
entry = AddressEntry()
width = int(gtk.gdk.screen_width() / 3 * 2)
entry.set_size_request(width, -1)
entry.connect("activate", self.__activate_cb)
self.add(entry)
entry.show()
self._entry = entry
def __activate_cb(self, entry):
self.emit('open-address', entry.get_text())
def set_progress(self, progress):
self._entry.set_property('progress', progress)
+10 -5
View File
@@ -29,10 +29,10 @@ class NavigationToolbar(gtk.Toolbar):
self.insert(separator, -1)
separator.show()
address_item = AddressItem()
address_item.connect('open-address', self.__open_address_cb)
self.insert(address_item, -1)
address_item.show()
self._address_item = AddressItem()
self._address_item.connect('open-address', self.__open_address_cb)
self.insert(self._address_item, -1)
self._address_item.show()
self._insert_spring()
@@ -49,10 +49,15 @@ class NavigationToolbar(gtk.Toolbar):
self._embed.connect("location", self.__location_changed)
self._update_sensitivity()
self._embed.connect("notify::progress", self._progress_changed_cb)
def _update_sensitivity(self):
self.back.set_sensitive(self._embed.can_go_back())
self.forward.set_sensitive(self._embed.can_go_forward())
def _progress_changed_cb(self, embed, pspec):
self._address_item.set_progress(embed.props.progress)
def __go_back_cb(self, button):
self._embed.go_back()
+1 -1
View File
@@ -51,6 +51,6 @@ class NotificationBar(gtk.HBox):
def set_action(self, action_id, action_text):
self._action_id = action_id
self._action_button.set_label(action_text)
def __button_clicked(self, button):
self.emit("action", self._action_id)