~gary-lasker/software-center/launcher-integration-lp761851

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/panes/availablepane.py

  • Committer: Gary Lasker
  • Date: 2011-12-05 20:39:56 UTC
  • Revision ID: gary.lasker@canonical.com-20111205203956-q86rqjgaw09l4fla
minor code tweaks and update unit tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
342
342
            
343
343
    def on_transaction_started(self, backend, pkgname, appname, trans_id, 
344
344
                               trans_type):
345
 
        self._register_unity_launcher_transaction_started(
346
 
            backend, pkgname, appname, trans_id, trans_type)
 
345
        self._add_application_to_unity_launcher(
 
346
                backend, pkgname, appname, trans_id, trans_type)
347
347
 
348
 
    def _register_unity_launcher_transaction_started(self, backend, pkgname, 
349
 
                                                     appname, trans_id, 
350
 
                                                     trans_type):
 
348
    def _add_application_to_unity_launcher(self, backend, pkgname, 
 
349
                                           appname, trans_id, 
 
350
                                           trans_type):
351
351
        if not self.add_to_launcher_enabled:
352
352
            return
353
353
        # mvo: use use softwarecenter.utils explictly so that we can monkey
354
354
        #      patch it in the test
355
355
        if not softwarecenter.utils.is_unity_running():
356
356
            return
357
 
        # we only care about getting the launcher information on an install
 
357
        # we only care about installs
358
358
        if not trans_type == TransactionTypes.INSTALL:
359
359
            return
360
360
            
370
370
 
371
371
        # now gather up the unity launcher info items and send the app to the
372
372
        # launcher service
 
373
        launcher_info = self._get_unity_launcher_info(app, appdetails, trans_id)
 
374
        self.unity_launcher.send_application_to_launcher(pkgname, launcher_info)
 
375
        
 
376
    def _get_unity_launcher_info(self, app, appdetails, trans_id):
373
377
        (icon_size, icon_x, icon_y) = (
374
378
                self._get_onscreen_icon_details_for_launcher_service(app))
375
379
        icon_path = get_file_path_from_iconname(
383
387
                                          icon_size,
384
388
                                          appdetails.desktop_file,
385
389
                                          trans_id)
386
 
        self.unity_launcher.send_application_to_launcher(pkgname, launcher_info)
 
390
        return launcher_info
387
391
 
388
392
    def _get_onscreen_icon_details_for_launcher_service(self, app):
389
393
        if self.is_app_details_view_showing():