~ubuntu-branches/ubuntu/maverick/gnome-screensaver/maverick

« back to all changes in this revision

Viewing changes to debian/source_gnome-screensaver.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-03-07 00:01:22 UTC
  • Revision ID: james.westby@ubuntu.com-20100307000122-dguzj6ne382b25i7
Tags: 2.29.91-0ubuntu3
* debian/source_gnome-screensaver.py: 
  - Fetch inhibitors from gnome-session and add them to the submitted bug
    report (under the 'GnomeSessionInhibitors' key). Also provide an overall
    summary indicating if the session has been inhibited from going idle 
    (under them 'GnomeSessionIdleInhibited' key). The information is useful 
    for debugging screensaver activation issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
(c) 2010 Canonical Ltd.
6
6
Contributors:
7
7
Marc Deslauriers <marc.deslauriers@canonical.com>
 
8
Chris Coulson <chris.coulson@canonical.com>
8
9
 
9
10
This program is free software; you can redistribute it and/or modify it
10
11
under the terms of the GNU General Public License as published by the
14
15
'''
15
16
 
16
17
from apport.hookutils import *
 
18
import dbus
17
19
 
18
20
def add_info(report):
19
21
 
20
 
 
21
22
    attach_file_if_exists(report, '/etc/X11/xorg.conf', 'XorgConf')
22
23
    attach_file_if_exists(report, '/var/log/Xorg.0.log', 'XorgLog')
23
24
    attach_file_if_exists(report, '/var/log/Xorg.0.log.old', 'XorgLogOld')
30
31
    report['GconfGnomeSession'] = command_output(['gconftool-2', '-R', '/desktop/gnome/session'])
31
32
    report['GconfGnomeLockdown'] = command_output(['gconftool-2', '-R', '/desktop/gnome/lockdown'])
32
33
 
 
34
    try:
 
35
        bus = dbus.SessionBus()
 
36
        session_manager = bus.get_object('org.gnome.SessionManager', '/org/gnome/SessionManager')
 
37
        session_manager_iface = dbus.Interface(session_manager, dbus_interface='org.gnome.SessionManager')
 
38
        inhibitors = session_manager_iface.GetInhibitors()
 
39
        inhibitors_str = ''
 
40
        master_flag = 0
 
41
        j = 1
 
42
        for i in inhibitors:
 
43
            obj = bus.get_object('org.gnome.SessionManager', i)
 
44
            iface = dbus.Interface(obj, dbus_interface='org.gnome.SessionManager.Inhibitor')
 
45
            app_id = iface.GetAppId()
 
46
            flags = iface.GetFlags()
 
47
            reason = iface.GetReason()
 
48
            if j > 1:
 
49
                    inhibitors_str += '\n'
 
50
            inhibitors_str += str(j) + ': AppId = ' + app_id + ', Flags = ' + str(flags) + ', Reason = ' + reason
 
51
            j = j + 1
 
52
            master_flag |= flags
 
53
 
 
54
        report['GnomeSessionInhibitors'] = 'None' if inhibitors_str == '' else inhibitors_str
 
55
        report['GnomeSessionIdleInhibited'] = 'Yes' if master_flag & 8 else 'No'
 
56
    except:
 
57
        report['GnomeSessionInhibitors'] = 'Failed to acquire'
 
58
        report['GnomeSessionIdleInhibited'] = 'Unknown'
 
59
 
33
60
if __name__ == '__main__':
34
61
    report = {}
35
62
    add_info(report)