~ubuntu-branches/ubuntu/maverick/lxpanel/maverick

« back to all changes in this revision

Viewing changes to debian/apport/source_lxpanel.py

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-09-23 23:48:30 UTC
  • Revision ID: james.westby@ubuntu.com-20100923234830-9rmsl9vdmt7sdbx5
Tags: 0.5.6-0ubuntu2
* debian/apport/source_lxpanel.py
 - Add apport hook.
* debian/rules
 - Install apport hook only on Ubuntu.
* debian/control:
 - Build-depends on lsb-release, needed to detect the distribution.
 - Build-depends on libindicator-dev (>= 0.3.14) to rebuild on lastest
   libindicator. (LP: #637692).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""
 
2
  Copyright (c) 2010 Julien Lavergne <gilir@ubuntu.com>
 
3
 
 
4
  This program is free software; you can redistribute it and/or modify
 
5
  it under the terms of the GNU General Public License as published by
 
6
  the Free Software Foundation; either version 2 of the License, or
 
7
  (at your option) any later version.
 
8
 
 
9
  This program is distributed in the hope that it will be useful,
 
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
  GNU General Public License for more details.
 
13
 
 
14
  You should have received a copy of the GNU General Public License
 
15
  along with this program; if not, write to the Free Software Foundation,
 
16
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
17
"""
 
18
 
 
19
import os
 
20
import apport.hookutils
 
21
 
 
22
#Detect session
 
23
session = os.environ['DESKTOP_SESSION']
 
24
 
 
25
#If it's not Lubuntu or LXDE, fallback to default location
 
26
if session <> "Lubuntu" and session <> "LXDE":
 
27
    session = "default"
 
28
 
 
29
#Set location of various configuration files
 
30
system_conf = "/usr/share/lxpanel/profile/"
 
31
home_conf = os.path.expanduser("~/.config/lxpanel/")
 
32
 
 
33
#Set description for each file reported by apport
 
34
report_config_system = "Config_System_" + session
 
35
report_panel_system = "Panel_System_" + session
 
36
report_config_home = "Config_Home_" + session
 
37
report_panel_home = "Panel_Home_" + session
 
38
 
 
39
def add_info(report):
 
40
    # If a config file exist in HOME, report it instead of the system one.
 
41
    if os.path.exists(os.path.join(home_conf,session,"config")):
 
42
        report[report_config_home] = apport.hookutils.read_file(os.path.join(home_conf,session,"config"))
 
43
    else:
 
44
        report[report_config_system] = apport.hookutils.read_file(os.path.join(system_conf,session,"config"))
 
45
    
 
46
    if os.path.exists(os.path.join(home_conf,session,"panels/panel")):
 
47
        report[report_panel_home] = apport.hookutils.read_file(os.path.join(home_conf,session,"panels/panel"))
 
48
    else:
 
49
        report[report_panel_system] = apport.hookutils.read_file(os.path.join(system_conf,session,"panels/panel"))