-
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Option: Auto-download episodes when on Wi-Fi (Maemo bug 5181)
- Loading branch information
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# gPodder - A media aggregator and podcast client | ||
# Copyright (c) 2005-2011 Thomas Perl and the gPodder Team | ||
# | ||
# gPodder is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# gPodder is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
|
||
# gpodder.gtkui.frmntl.network - Network connection manager | ||
# Thomas Perl <thp@gpodder.org>; 2011-02-19 | ||
|
||
|
||
import dbus | ||
import conic | ||
|
||
|
||
class NetworkManager(object): | ||
ICD_NAME = 'com.nokia.icd' | ||
ICD_PATH = '/com/nokia/icd' | ||
ICD_INTF = 'com.nokia.icd' | ||
|
||
def __init__(self): | ||
self.system_bus = dbus.Bus.get_system() | ||
self.icd_obj = self.system_bus.get_object(self.ICD_NAME, \ | ||
self.ICD_PATH) | ||
self.icd = dbus.Interface(self.icd_obj, self.ICD_INTF) | ||
self.conic = conic.Connection() | ||
|
||
def get_current_iap(self): | ||
try: | ||
iap_id, _, _, _, _, _, _ = self.icd.get_statistics() | ||
except Exception, e: | ||
return None | ||
return self.conic.get_iap(iap_id) | ||
|
||
def get_bearer_type(self): | ||
iap = self.get_current_iap() | ||
if iap is None: | ||
return None | ||
return iap.get_bearer_type() | ||
|
||
def connection_is_wlan(self): | ||
return self.get_bearer_type() in (conic.BEARER_WLAN_INFRA, \ | ||
conic.BEARER_WLAN_ADHOC) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters