~ubuntu-branches/ubuntu/quantal/zeitgeist/quantal

« back to all changes in this revision

Viewing changes to _zeitgeist/singleton.py

* New upstream release. Some of the changes are:
   - Various performance improvements (speed, reduced I/O, etc).
   - Enhancements to the extensions system (eg. feature to ask which
     extensions are active).
   - Various bug fixes (eg. fixed find_event_for_template Python API method).
   - Added new mimetype mappings.
* Updated debian/copyright and debian/zeitgeist-core.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#
8
8
# This program is free software: you can redistribute it and/or modify
9
9
# it under the terms of the GNU Lesser General Public License as published by
10
 
# the Free Software Foundation, either version 3 of the License, or
 
10
# the Free Software Foundation, either version 2.1 of the License, or
11
11
# (at your option) any later version.
12
12
#
13
13
# This program is distributed in the hope that it will be useful,
40
40
                
41
41
                if dbus_service.NameHasOwner(ZeitgeistDBusInterface.BUS_NAME):
42
42
                        # already running daemon instance
43
 
                        if _config.options.replace or _config.options.quit:
 
43
                        if hasattr(_config, "options") and (_config.options.replace or _config.options.quit):
44
44
                                if _config.options.quit:
45
45
                                        logging.info("Stopping the currently running instance.")
46
46
                                else:
47
47
                                        logging.debug("Replacing currently running process.")
48
 
                                # TODO: This only works for the engine and wont work for the DataHub
49
48
                                interface = ZeitgeistDBusInterface()
50
49
                                interface.Quit()
51
50
                                while dbus_service.NameHasOwner(ZeitgeistDBusInterface.BUS_NAME):
58
57
                                        ("An existing instance was found. Please use "
59
58
                                         "--replace to quit it and start a new instance.")
60
59
                                )
61
 
                elif _config.options.quit:
 
60
                elif hasattr(_config, "options") and _config.options.quit:
62
61
                        logging.info("There is no running instance; doing nothing.")
63
62
                else:
64
63
                        # service is not running, save to start
65
64
                        logging.debug("No running instances found.")
66
65
                
67
 
                if _config.options.quit:
 
66
                if hasattr(_config, "options") and _config.options.quit:
68
67
                        sys.exit(0)
69
68
                
70
69
                bus = dbus.service.BusName(ZeitgeistDBusInterface.BUS_NAME, sbus, do_not_queue=True)