~ubuntu-branches/ubuntu/precise/empathy/precise-proposed-201205180810

« back to all changes in this revision

Viewing changes to telepathy-yell/tools/glib-errors-enum-header-gen.py

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis, Brian Curtis, Ken VanDine
  • Date: 2011-06-01 10:35:24 UTC
  • mfrom: (1.1.70 upstream) (6.3.44 experimental)
  • Revision ID: james.westby@ubuntu.com-20110601103524-wx3wgp71394730jt
Tags: 3.1.1-1ubuntu1
[ Brian Curtis ]
* Merge with Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Drop geoclue/mapping build-depends (they are in Universe)
  - Add Vcz-Bzr link
  - Add Suggests on telepathy-idle
  - Bump telepathy-butterfly, telepathy-haze to recommends
  - Don't recommend the freedesktop sound theme we have an ubuntu one
  - Add build depend for libunity-dev
* debian/rules:
  - Use autoreconf.mk
  - Disable map and location
* debian/empathy.install:
  - Install message indicator configuration
* debian/indicators/empathy:
  - Message indicator configuration
* debian/patches/01_lpi.patch:
  - Add Launchpad integration
* debian/patches/10_use_notify_osd_icons.patch:
  - Use the notify-osd image for new messages
* debian/patches/34_start_raised_execpt_in_session.patch
  - If not started with the session, we should always raise
* debian/patches/36_chat_window_default_size.patch:
  - Make the default chat window size larger
* debian/patches/37_facebook_default.patch:
  - Make facebook the default chat account type
* debian/patches/38_lp_569289.patch
  - Set freenode as default IRC network for new IRC accounts 
* debian/patches/41_unity_launcher_progress.patch
  - Display file transfer progress in the unity launcher

[ Ken VanDine ]
* debian/control
  - build depend on libgcr-3-dev instead of libgcr-dev
  - dropped build depends for libindicate, we will use telepathy-indicator
  - Depend on dconf-gsettings-backend | gsettings-backend
  - Added a Recommends for telepathy-indicator
* +debian/empathy.gsettings-override
  - Added an override for notifications-focus
* debian/patches/series
  - commented out 23_idomessagedialog_for_voip_and_ft.patch, until ido has 
    been ported to gtk3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
import sys
4
 
import xml.dom.minidom
5
 
 
6
 
from libglibcodegen import NS_TP, camelcase_to_upper, get_docstring, \
7
 
        get_descendant_text
8
 
 
9
 
class Generator(object):
10
 
    def __init__(self, dom):
11
 
        self.dom = dom
12
 
        self.errors = self.dom.getElementsByTagNameNS(NS_TP, 'errors')[0]
13
 
 
14
 
    def do_header(self):
15
 
        print '/* Generated from the Telepathy spec\n'
16
 
        copyrights = self.errors.getElementsByTagNameNS(NS_TP, 'copyright')
17
 
        for copyright in copyrights:
18
 
            print get_descendant_text(copyright)
19
 
        license = self.errors.getElementsByTagNameNS(NS_TP, 'license')[0]
20
 
        print '\n' + get_descendant_text(license) + '\n*/'
21
 
 
22
 
    def do_gtkdoc(self):
23
 
        for error in self.errors.getElementsByTagNameNS(NS_TP, 'error'):
24
 
            ns = error.parentNode.getAttribute('namespace')
25
 
            nick = error.getAttribute('name').replace(' ', '')
26
 
            enum = 'TP_ERROR_' + camelcase_to_upper(nick.replace('.', ''))
27
 
            print ' * @' + enum + ': ' + ns + '.' + nick + ':'
28
 
            print ' *     ' + get_docstring(error) + '    '
29
 
 
30
 
    def do_enumnames(self):
31
 
        for error in self.errors.getElementsByTagNameNS(NS_TP, 'error'):
32
 
            nick = error.getAttribute('name').replace(' ', '')
33
 
            enum = 'TP_ERROR_' + camelcase_to_upper(nick.replace('.', ''))
34
 
            print '    ' + enum + ','
35
 
 
36
 
    def do_get_type(self):
37
 
        print """
38
 
#include <glib-object.h>
39
 
 
40
 
G_BEGIN_DECLS
41
 
 
42
 
GType tp_error_get_type (void);
43
 
 
44
 
/**
45
 
 * TP_TYPE_ERROR:
46
 
 *
47
 
 * The GType of the Telepathy error enumeration.
48
 
 */
49
 
#define TP_TYPE_ERROR (tp_error_get_type())
50
 
"""
51
 
 
52
 
    def do_enum(self):
53
 
        print """\
54
 
/**
55
 
 * TpError:"""
56
 
        self.do_gtkdoc()
57
 
        print """\
58
 
 *
59
 
 * Enumerated type representing the Telepathy D-Bus errors.
60
 
 */
61
 
typedef enum {"""
62
 
        self.do_enumnames()
63
 
        print """\
64
 
} TpError;
65
 
 
66
 
G_END_DECLS"""
67
 
 
68
 
    def __call__(self):
69
 
        self.do_header()
70
 
        self.do_get_type()
71
 
        self.do_enum()
72
 
 
73
 
if __name__ == '__main__':
74
 
    argv = sys.argv[1:]
75
 
    Generator(xml.dom.minidom.parse(argv[0]))()