~mpt/software-center/help-3.0

« back to all changes in this revision

Viewing changes to softwarecenter/gwibber_helper.py

  • Committer: Michael Vogt
  • Date: 2010-09-07 12:53:30 UTC
  • mfrom: (1085.7.6 gwibber-tweaks)
  • Revision ID: michael.vogt@ubuntu.com-20100907125330-9pzgsvrv9cto1ob8
merged lp:~mmcg069/software-center/bug628714, many thanks
(LP: #628714)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2010 Matthew McGowan
 
2
#
 
3
# Authors:
 
4
#  Matthew McGowan
 
5
#
 
6
# This program is free software; you can redistribute it and/or modify it under
 
7
# the terms of the GNU General Public License as published by the Free Software
 
8
# Foundation; version 3.
 
9
#
 
10
# This program is distributed in the hope that it will be useful, but WITHOUT
 
11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
12
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
13
# details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License along with
 
16
# this program; if not, write to the Free Software Foundation, Inc.,
 
17
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
18
 
 
19
 
 
20
import json
 
21
#from dbus.mainloop.glib import DBusGMainLoop
 
22
 
 
23
#DBusGMainLoop(set_as_default=True)
 
24
 
 
25
try:
 
26
    from gwibber.lib import GwibberPublic
 
27
    _gwibber_is_available = True
 
28
    Gwibber = GwibberPublic()
 
29
    Gwibber.service.refresh()
 
30
except:
 
31
    _gwibber_is_available = False
 
32
 
 
33
 
 
34
def gwibber_service_available():
 
35
    if not _gwibber_is_available:
 
36
        return False
 
37
    return len(json.loads(Gwibber.GetAccounts())) > 0
 
38
 
 
39
GWIBBER_SERVICE_AVAILABLE = gwibber_service_available()
 
40
#print 'Gwibber Serice Available: %s' % GWIBBER_SERVICE_AVAILABLE 
 
41
 
 
42
 
 
43
 
 
44