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

« back to all changes in this revision

Viewing changes to telepathy-yell/tools/glib-errors-enum-body-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_enum_values(self):
23
 
        for error in self.errors.getElementsByTagNameNS(NS_TP, 'error'):
24
 
            print ''
25
 
            nick = error.getAttribute('name').replace(' ', '')
26
 
            name = camelcase_to_upper(nick.replace('.', ''))
27
 
            ns = error.parentNode.getAttribute('namespace')
28
 
            enum = 'TP_ERROR_' + name
29
 
            print '        /* ' + ns + '.' + name
30
 
            print '    ' + get_docstring(error)
31
 
            print '     */'
32
 
            print '        { %s, "%s", "%s" },' % (enum, enum, nick)
33
 
 
34
 
 
35
 
    def do_get_type(self):
36
 
        print """
37
 
#include <_gen/telepathy-errors.h>
38
 
 
39
 
GType
40
 
tp_error_get_type (void)
41
 
{
42
 
  static GType etype = 0;
43
 
  if (G_UNLIKELY (etype == 0))
44
 
    {
45
 
      static const GEnumValue values[] = {"""
46
 
        self.do_enum_values()
47
 
        print """\
48
 
      };
49
 
 
50
 
      etype = g_enum_register_static ("TpError", values);
51
 
    }
52
 
  return etype;
53
 
}
54
 
"""
55
 
 
56
 
    def __call__(self):
57
 
        self.do_header()
58
 
        self.do_get_type()
59
 
 
60
 
if __name__ == '__main__':
61
 
    argv = sys.argv[1:]
62
 
    Generator(xml.dom.minidom.parse(argv[0]))()