def _add_application_to_unity_launcher(self, transaction_details):
        app = Application(pkgname=transaction_details.pkgname,
                          appname=transaction_details.appname)
        appdetails = app.get_details(self.db)
        # convert the app-install desktop file location to the actual installed
        # desktop file location (or in the case of a purchased item from the
        # agent, generate the correct installed desktop file location)
        installed_desktop_file_path = (
            convert_desktop_file_to_installed_location(appdetails.desktop_file,
                                                       app.pkgname))
        # we only add items to the launcher that have a desktop file
        if not installed_desktop_file_path:
            return
        # do not add apps that have no Exec entry in their desktop file
        # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
        # see LP: #913756), also, don't add the item if NoDisplay is
        # specified (see LP: #1006483)
        if (os.path.exists(installed_desktop_file_path) and
            (not get_exec_line_from_desktop(installed_desktop_file_path)
             or is_no_display_desktop_file(installed_desktop_file_path))):
            return

        # now gather up the unity launcher info items and send the app to the
        # launcher service
        launcher_info = self._get_unity_launcher_info(
            app, appdetails, installed_desktop_file_path,
            transaction_details.trans_id)
        self.unity_launcher.send_application_to_launcher(
            transaction_details.pkgname, launcher_info)
    def _add_application_to_unity_launcher(self, transaction_details):
        if not self.add_to_launcher_enabled:
            return
        # mvo: use use softwarecenter.utils explicitly so that we can monkey
        #      patch it in the test
        if not softwarecenter.utils.is_unity_running():
            return

        app = Application(pkgname=transaction_details.pkgname,
                          appname=transaction_details.appname)
        appdetails = app.get_details(self.db)
        # we only add items to the launcher that have a desktop file
        if not appdetails.desktop_file:
            return
        # do not add apps that have no Exec entry in their desktop file
        # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
        # see LP: #913756)
        if (os.path.exists(appdetails.desktop_file)
                and not get_exec_line_from_desktop(appdetails.desktop_file)):
            return

        # now gather up the unity launcher info items and send the app to the
        # launcher service
        launcher_info = self._get_unity_launcher_info(
            app, appdetails, transaction_details.trans_id)
        self.unity_launcher.send_application_to_launcher(
            transaction_details.pkgname, launcher_info)
Beispiel #3
0
    def _add_application_to_unity_launcher(self, transaction_details):
        if not self.add_to_launcher_enabled:
            return
        # mvo: use use softwarecenter.utils explicitly so that we can monkey
        #      patch it in the test
        if not softwarecenter.utils.is_unity_running():
            return

        app = Application(pkgname=transaction_details.pkgname,
                          appname=transaction_details.appname)
        appdetails = app.get_details(self.db)
        # we only add items to the launcher that have a desktop file
        if not appdetails.desktop_file:
            return
        # do not add apps that have no Exec entry in their desktop file
        # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
        # see LP: #913756)
        if (os.path.exists(appdetails.desktop_file) and
            not get_exec_line_from_desktop(appdetails.desktop_file)):
            return

        # now gather up the unity launcher info items and send the app to the
        # launcher service
        launcher_info = self._get_unity_launcher_info(app, appdetails,
                transaction_details.trans_id)
        self.unity_launcher.send_application_to_launcher(
                transaction_details.pkgname,
                launcher_info)
    def _add_application_to_unity_launcher(self, transaction_details):
        app = Application(pkgname=transaction_details.pkgname,
                          appname=transaction_details.appname)
        appdetails = app.get_details(self.db)
        # convert the app-install desktop file location to the actual installed
        # desktop file location (or in the case of a purchased item from the
        # agent, generate the correct installed desktop file location)
        installed_desktop_file_path = (
            convert_desktop_file_to_installed_location(appdetails.desktop_file,
                                                       app.pkgname))
        # we only add items to the launcher that have a desktop file
        if not installed_desktop_file_path:
            return
        # do not add apps that have no Exec entry in their desktop file
        # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
        # see LP: #913756), also, don't add the item if NoDisplay is
        # specified (see LP: #1006483)
        if (os.path.exists(installed_desktop_file_path) and
            (not get_exec_line_from_desktop(installed_desktop_file_path) or
            is_no_display_desktop_file(installed_desktop_file_path))):
            return

        # now gather up the unity launcher info items and send the app to the
        # launcher service
        launcher_info = self._get_unity_launcher_info(app, appdetails,
                installed_desktop_file_path,
                transaction_details.trans_id)
        self.unity_launcher.send_application_to_launcher(
                transaction_details.pkgname,
                launcher_info)
Beispiel #5
0
    def _add_application_to_unity_launcher(self, trans_details):
        # do not add apps that have no Exec entry in their desktop file
        # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
        # see LP: #913756), also, don't add the item if NoDisplay is
        # specified (see LP: #1006483)
        if (os.path.exists(trans_details.desktop_file) and
                (not get_exec_line_from_desktop(trans_details.desktop_file) or
                 is_no_display_desktop_file(trans_details.desktop_file))):
            return

        # now gather up the unity launcher info items and send the app to the
        # launcher service
        launcher_info = self._get_unity_launcher_info(trans_details)
        self.unity_launcher.send_application_to_launcher(
            trans_details.app.pkgname, launcher_info)
Beispiel #6
0
        def guess_final_desktop_file(self):
            if self.__real_desktop:
                return self.__real_desktop

            # convert the app-install desktop file location to the actual installed
            # desktop file location (or in the case of a purchased item from the
            # agent, generate the correct installed desktop file location)
            desktop_file = (
                convert_desktop_file_to_installed_location(self.desktop_file,
                                                           self.app.pkgname))
            # we only add items to the launcher that have a desktop file
            if not desktop_file:
                return
            # do not add apps that have no Exec entry in their desktop file
            # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
            # see LP: #913756), also, don't add the item if NoDisplay is
            # specified (see LP: #1006483)
            if (os.path.exists(desktop_file) and
                    (not get_exec_line_from_desktop(desktop_file) or
                    is_no_display_desktop_file(desktop_file))):
                return

            self.__real_desktop = desktop_file
            return self.__real_desktop