~nataliabidart/ubuntuone-control-panel/disable-files

« back to all changes in this revision

Viewing changes to bin/ubuntuone-control-panel-gtk

  • Committer: Natalia B. Bidart
  • Date: 2011-04-01 20:05:07 UTC
  • mfrom: (117.1.5 ubuntuone-control-panel)
  • Revision ID: natalia.bidart@canonical.com-20110401200507-9hl6n7pg5spwelaz
MergedĀ trunkĀ in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# -*- coding: utf-8 -*-
3
3
 
4
4
# Authors: Natalia B Bidart <natalia.bidart@canonical.com>
 
5
#          Eric Casteleijn <eric.casteleijn@canonical.com>
5
6
#
6
7
# Copyright 2010 Canonical Ltd.
7
8
#
20
21
 
21
22
# Invalid name "ubuntuone-control-panel-gtk", pylint: disable=C0103
22
23
 
 
24
import gettext
23
25
import sys
24
26
 
25
 
import dbus.mainloop.glib
26
 
import gettext
27
 
 
28
27
from optparse import OptionParser
29
28
 
30
 
from ubuntuone.controlpanel.gtk import DBUS_BUS_NAME, TRANSLATION_DOMAIN
 
29
from ubuntuone.controlpanel.gtk import TRANSLATION_DOMAIN
31
30
 
32
 
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
33
31
gettext.textdomain(TRANSLATION_DOMAIN)
34
 
 
35
32
# import the GUI after the translation domain has been set
36
 
from ubuntuone.controlpanel.gtk.gui import ControlPanelWindow
 
33
from ubuntuone.controlpanel.gtk.gui import main
37
34
 
38
35
 
39
36
def parser_options():
41
38
    usage = "Usage: %prog [option]"
42
39
    result = OptionParser(usage=usage)
43
40
    result.add_option("", "--switch-to", dest="switch_to", type="string",
44
 
                      metavar="PANEL_NAME",
 
41
                      metavar="PANEL_NAME", default="",
45
42
                      help="Start the Ubuntu One Control Panel (GTK) in the "
46
43
                           "PANEL_NAME tab. Possible values are: "
47
44
                           "dashboard, volumes, devices, applications")
48
45
    result.add_option("-a", "--alert", dest="alert", action="store_true",
49
 
                      help="Start the Ubuntu One Control Panel (GTK) alerting "
50
 
                      "the user to its presence.")
 
46
                      default=False, help="Start the Ubuntu One Control Panel "
 
47
                      "(GTK) alerting the user to its presence.")
51
48
    return result
52
49
 
53
50
 
54
51
if __name__ == "__main__":
55
 
    bus = dbus.SessionBus()
56
 
    name = bus.request_name(DBUS_BUS_NAME,
57
 
                            dbus.bus.NAME_FLAG_DO_NOT_QUEUE)
58
 
    if name == dbus.bus.REQUEST_NAME_REPLY_EXISTS:
59
 
        sys.exit(0)
60
 
 
61
 
    bus_name = dbus.service.BusName(DBUS_BUS_NAME, bus=dbus.SessionBus())
62
52
    parser = parser_options()
63
53
    (options, args) = parser.parse_args(sys.argv)
64
 
    gui = ControlPanelWindow(
65
 
        switch_to=options.switch_to, alert=options.alert)
66
 
    gui.main()
 
54
    main(switch_to=options.switch_to, alert=options.alert)