12 |
|
|
13 |
def maybe_poll(self): |
def maybe_poll(self): |
14 |
self.poll_network() |
self.poll_network() |
15 |
|
config = straw.Config.get_instance() |
16 |
|
time_diff = int(time.time()) - config.last_poll |
17 |
|
|
18 |
time_diff = int(time.time()) - straw.config.last_poll |
if config.poll_frequency > 0 and not config.offline and time_diff > config.poll_frequency: |
|
|
|
|
if straw.config.poll_frequency > 0 and not straw.config.offline and time_diff > straw.config.poll_frequency: |
|
19 |
self.poll() |
self.poll() |
20 |
|
|
21 |
gtk.timeout_add(straw.NetworkConstants.POLL_INTERVAL, self.maybe_poll) |
gtk.timeout_add(straw.NetworkConstants.POLL_INTERVAL, self.maybe_poll) |
22 |
|
|
23 |
def poll(self, feed = None): |
def poll(self, feed = None): |
24 |
if straw.config.offline: |
config = straw.Config.get_instance() |
25 |
|
if config.offline: |
26 |
if feed is not None: |
if feed is not None: |
27 |
e_title = _("Unable to Poll %s") % feed.title |
e_title = _("Unable to Poll %s") % feed.title |
28 |
e_body = _("You are currently offline. You have to be online to be able to poll this feed.") |
e_body = _("You are currently offline. You have to be online to be able to poll this feed.") |
37 |
if feed: |
if feed: |
38 |
feeds = [feed] |
feeds = [feed] |
39 |
else: |
else: |
40 |
feeds = straw.config.feeds |
feeds = config.feeds |
41 |
straw.config.last_poll = int(time.time()) |
config.last_poll = int(time.time()) |
42 |
|
|
43 |
straw.main.display_status_message(_("Polling feeds...")) |
straw.main.display_status_message(_("Polling feeds...")) |
44 |
|
|