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 show_add_to_launcher_panel(self, backend, pkgname, appname, app, appdetails, trans_id, trans_type): """ if Unity is currently running, display a panel to allow the user the choose whether to add a newly-installed application to the launcher """ # TODO: handle local deb install case # TODO: implement the list view case (once it is specified) # only show the panel if unity is running and this is a package install # # we only show the prompt for apps with a desktop file if not appdetails.desktop_file: return # do not add apps without a exec line (like wine, see #848437) if (os.path.exists(appdetails.desktop_file) and is_no_display_desktop_file(appdetails.desktop_file)): return self.action_bar.add_button(ActionButtons.CANCEL_ADD_TO_LAUNCHER, _("Not Now"), self.on_cancel_add_to_launcher, pkgname) self.action_bar.add_button(ActionButtons.ADD_TO_LAUNCHER, _("Add to Launcher"), self.on_add_to_launcher, pkgname, app, appdetails, trans_id) self.action_bar.set_label(utf8(_("Add %s to the launcher?")) % utf8(app.name))
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, 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)
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
def test_no_display_desktop_file(self): from softwarecenter.utils import is_no_display_desktop_file d = "/usr/share/app-install/desktop/wine1.4:wine.desktop" self.assertTrue(is_no_display_desktop_file(d)) d = "/usr/share/app-install/desktop/software-center:ubuntu-software-center.desktop" self.assertFalse(is_no_display_desktop_file(d))