Example #1
0
    def _install_app(self, report_install=True):
        installer = AppInstaller(self._app['id'], self._apps, None,
                                 self._window)
        installer.set_report_install(report_install)
        if not installer.install():
            return

        # We need to reload the application information, readd it to
        # the desktop and send an update to the parent object.
        new_app = load_from_app_file(installer.get_loc())
        self._app['origin'] = new_app['origin']
        remove_from_desktop(self._app)
        self._apps.update_app(new_app)
        add_to_desktop(new_app)
Example #2
0
    def _install_app(self, report_install=True):
        installer = AppInstaller(self._app['id'], self._apps, None,
                                 self._window)
        installer.set_report_install(report_install)
        if not installer.install():
            return

        # We need to reload the application information, readd it to
        # the desktop and send an update to the parent object.
        new_app = load_from_app_file(installer.get_loc())
        self._app['origin'] = new_app['origin']
        remove_from_desktop(self._app)
        self._apps.update_app(new_app)

        if new_app.get('desktop'):
            add_to_desktop(new_app)
Example #3
0
 def _desktop_cb(self, event):
     if not self._is_on_desktop():
         if add_to_desktop(self._app):
             self._apps.update_app(self._app)
     else:
         if remove_from_desktop(self._app):
             self._apps.update_app(self._app)
Example #4
0
 def _desktop_cb(self, event):
     if not self._is_on_desktop():
         if add_to_desktop(self._app):
             self._apps.update_app(self._app)
     else:
         if remove_from_desktop(self._app):
             self._apps.update_app(self._app)
Example #5
0
    def _uninstall_cb(self, event):
        confirmation = KanoDialog(
            title_text=_("Removing {}").format(self._app["title"]),
            description_text=_(
                "This application will be uninstalled and "
                "removed from apps. Do you wish to proceed?"
            ),
            button_dict={
                _("YES"): {
                    "return_value": 0
                },
                _("NO"): {
                    "return_value": -1,
                    "color": "red"
                }
            },
            parent_window=self._window
        )
        confirmation.title.description.set_max_width_chars(40)

        rv = confirmation.run()
        del confirmation
        if rv < 0:
            return

        prompt = _("Uninstalling {}").format(self._app["title"])
        pw = get_sudo_password(prompt, self._window)
        if pw is None:
            return

        self._window.blur()
        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
        while Gtk.events_pending():
            Gtk.main_iteration()

        success = uninstall_packages(self._app, pw)
        if success:
            remove_from_desktop(self._app)
            uninstall_link_and_icon(self._app["slug"], pw)

        self._apps.remove_app(self._app)

        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
        self._window.unblur()
Example #6
0
    def _uninstall_cb(self, event):
        confirmation = KanoDialog(
            title_text=_("Removing {}").format(self._app["title"]),
            description_text=_(
                "This application will be uninstalled and "
                "removed from apps. Do you wish to proceed?"
            ),
            button_dict={
                _("YES"): {
                    "return_value": 0
                },
                _("NO"): {
                    "return_value": -1,
                    "color": "red"
                }
            },
            parent_window=self._window
        )
        confirmation.title.description.set_max_width_chars(40)

        rv = confirmation.run()
        del confirmation
        if rv < 0:
            return

        prompt = _("Uninstalling {}").format(self._app["title"])
        pw = get_sudo_password(prompt, self._window)
        if pw is None:
            return

        self._window.blur()
        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
        while Gtk.events_pending():
            Gtk.main_iteration()

        success = uninstall_packages(self._app, pw)
        if success:
            remove_from_desktop(self._app)
            uninstall_link_and_icon(self._app["slug"], pw)

        self._apps.remove_app(self._app)

        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
        self._window.unblur()