~unity-team/unity-lens-bliss/trunk

« back to all changes in this revision

Viewing changes to bliss/apps.py

  • Committer: Mikkel Kamstrup Erlandsen
  • Date: 2011-11-03 11:47:33 UTC
  • Revision ID: mikkel.kamstrup@gmail.com-20111103114733-fsok51zb48jfk4d6
Fix distcheck and set the daemon code to import the bliss.apps module

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#
12
12
# The primary bus name we grab *must* match what we specify in our .lens file
13
13
#
14
 
BUS_NAME = "net.launchpad.UnityPlaceSample.Python"
 
14
BUS_NAME = "net.launchpad.UnityLensBliss.Lens"
15
15
 
16
16
# These category ids must match the order in which we add them to the lens
17
17
CATEGORY_LOWERCASE = 0
22
22
 
23
23
        def __init__ (self):
24
24
                # The path for the Lens *must* also match the one in our .lens file
25
 
                self._lens = Unity.Lens.new ("/net/launchpad/unitylenssample/python/lens", "python")
26
 
                self._scope = Unity.Scope.new ("/net/launchpad/unitylenssample/python/scope/main")
 
25
                self._lens = Unity.Lens.new ("/net/launchpad/unitylensbliss/lens", "bliss")
 
26
                self._scope = Unity.Scope.new ("/net/launchpad/unitylensbliss/scope/main")
27
27
                
28
28
                self._lens.props.search_hint = "Type something!"
29
29
                self._lens.props.visible = True;
148
148
                                      "text/html",                                 # mimetype
149
149
                                      letter,                                      # display name
150
150
                                      "See Wikipedia article about '%s'" % letter, # comment
151
 
                                      uri)                                         # FIXME WHATSTHIS?
152
 
 
153
 
if __name__ == "__main__":
154
 
        # NOTE: If we used the normal 'dbus' module for Python we'll get
155
 
        #       slightly odd results because it uses a default connection
156
 
        #       to the session bus that is different from the default connection
157
 
        #       GDBus (hence libunity) will use. Meaning that the daemon name
158
 
        #       will be owned by a connection different from the one all our
159
 
        #       Dee + Unity magic is working on...
160
 
        #       Still waiting for nice GDBus bindings to land:
161
 
        #                        http://www.piware.de/2011/01/na-zdravi-pygi/
162
 
        
163
 
        session_bus_connection = Gio.bus_get_sync (Gio.BusType.SESSION, None)
164
 
        session_bus = Gio.DBusProxy.new_sync (session_bus_connection, 0, None,
165
 
                                              'org.freedesktop.DBus',
166
 
                                              '/org/freedesktop/DBus',
167
 
                                              'org.freedesktop.DBus', None)
168
 
        result = session_bus.call_sync('RequestName',
169
 
                                       GLib.Variant ("(su)", (BUS_NAME, 0x4)),
170
 
                                       0, -1, None)
171
 
                                       
172
 
        # Unpack variant response with signature "(u)". 1 means we got it.
173
 
        result = result.unpack()[0]
174
 
        
175
 
        if result != 1 :
176
 
                print >> sys.stderr, "Failed to own name %s. Bailing out." % BUS_NAME
177
 
                raise SystemExit (1)
178
 
        
179
 
        daemon = Daemon()
180
 
        GObject.MainLoop().run()
 
151
                                      uri)                                         # dnd uri
181
152