Commit ded2e8ec by Ruben Rodriguez

Updated gnome-app-install for 6.0 and 7.0

parent 42ff4eaf

Too many changes to show.

To preserve performance only 367 of 367+ files are displayed.

Ross Burton <ross@burtonini.com>
Niran Babalola
Sebastian Heinlein <sebastian.heinlein@web.de>
Julian Andres Klode <jak@jak-linux.org>
Michael Vogt <michael.vogt@ubuntu.com>
# coding: utf-8
#
# Copyright (C) 2004-2005 Ross Burton <ross@burtonini.com>
# 2005-2007 Canonical
# 2006 Sebastian Heinlein
# Authors:
# Ross Burton
# Michael Vogt
# Sebastian Heinlein
# Ian Jackson
# Niran Babalola
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
# Don't forget to disbale this :)
#import pdb
import gtk
import gtk.gdk
import gobject
import gconf
import pango
from math import log
from widgets.SearchEntry import SearchEntry
from widgets.AppDescView import AppDescView
from widgets.AppListView import AppListView
import gc
import stat
import glob
import re
import subprocess
import tempfile
import warnings
import os
import sys
from datetime import datetime
import distros
import dbus
import dbus.service
import dbus.glib
import time
from warnings import warn
warnings.filterwarnings("ignore", "ICON:.*", UserWarning)
warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning)
import apt
import apt_pkg
# from update-manager, needs to be factored out
from aptsources.sourceslist import SourcesList, is_mirror
# internal imports
from DialogComplete import DialogComplete
from DialogPendingChanges import DialogPendingChanges
from DialogMultipleApps import DialogMultipleApps
from DialogProprietary import DialogProprietary
from Menu import ApplicationMenu
from SimpleGtkbuilderApp import SimpleGtkbuilderApp
from Progress import GtkOpProgressWindow, GtkCdromProgress, GtkMainIterationProgress
from Util import *
from packaging.Cache import MyCache, ThreadedCache
from Menu import (SHOW_ALL,
SHOW_ONLY_SUPPORTED,
SHOW_ONLY_FREE,
SHOW_ONLY_MAIN,
SHOW_ONLY_PROPRIETARY,
SHOW_ONLY_THIRD_PARTY,
SHOW_ONLY_INSTALLED)
from Menu import (COL_CAT_NAME,
COL_CAT_ITEM,
COL_CAT_PIXBUF)
import backend
import packaging
class AppInstallDbusControler(dbus.service.Object):
""" this is a helper to provide the AppInstallIFace """
def __init__(self, parent, bus_name,
object_path='/org/freedesktop/AppInstallObject'):
dbus.service.Object.__init__(self, bus_name, object_path)
self.parent = parent
@dbus.service.method('org.freedesktop.AppInstallIFace')
def bringToFront(self):
self.parent.window_main.present()
return True
class AppInstallApp(SimpleGtkbuilderApp):
def __init__(self, options, activation_style):
#FIXME: we have to disable dbus for the testing infrastructure,
# since it runs already in the main loop
if not options.test_mode:
self.setupDbus()
self.search_timeout_id = 0
self.activation_style = activation_style
self.distro = distros.get_distro()
# setup a default icon
self.icons = gtk.icon_theme_get_default()
try:
gtk.window_set_default_icon(self.icons.load_icon("gnome-app-install", 32, 0))
except gobject.GError:
pass
SimpleGtkbuilderApp.__init__(self, path=options.datadir+"/gnome-app-install.ui")
self.channelsdir = options.desktopdir+"/channels"
self.datadir = options.datadir
self.cachedir = options.cachedir
self.desktopdir = options.desktopdir
# the GdkWindow of the transient parent
self.transient_for = None
if options.transient_for:
self.transient_for = gtk.gdk.window_foreign_new(options.transient_for)
if self.transient_for:
self.window_main.realize()
self.window_main.window.set_transient_for(self.transient_for)
# sensitive stuff
self.button_ok.set_sensitive(False)
# are we sorting by popcon
self.sort_by_ranking = False
# setup the gconf backend
self.config = gconf.client_get_default()
self.config.add_dir ("/apps/gnome-app-install", gconf.CLIENT_PRELOAD_NONE)
# Tooltips
self.tooltips = gtk.Tooltips()
self.tipmap = {}
# Sexy search entry
self.search_entry = SearchEntry(self.icons)
self.search_hbox.add(self.search_entry)
self.search_entry.connect("terms-changed", self._perform_search)
self.search_entry.show()
self.treeview_packages = AppListView(self.icons)
self.scrolled_window.add(self.treeview_packages)
self.treeview_packages.show()
self.textview_description = AppDescView()
self.scrolled_description.add(self.textview_description)
self.scrolled_description.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
msg = _("To install an application check the box next to the "
"application. Uncheck the box to remove "
"the application.") + "\n"
msg += _("To perform advanced tasks use the "
"Synaptic package manager.")
header = _("Quick Introduction")
self.textview_description.show_message(header, msg)
self.textview_description.show()
# create the treeview
self.setupTreeview()
# seen flags
# FIXME: make those @properties that are auto-syned with gconf
self.components_seen = self.config.get_list("/apps/gnome-app-install/components_seen", "string")
# combobx with filters for the application list
filter_to_restore = self.config.get_int("/apps/gnome-app-install/filter_applications")
if filter_to_restore not in range(7):
filter_to_restore = 0
list_filters = gtk.ListStore(gobject.TYPE_STRING,
gobject.TYPE_BOOLEAN,
gobject.TYPE_STRING,
gobject.TYPE_INT)
self.combobox_filter.set_model(list_filters)
filter_renderer = gtk.CellRendererText()
self.combobox_filter.pack_start(filter_renderer)
# Prepare a set of filters
filters = []
# Load the primary filters of the distro
sorted_keys = self.distro.filters_primary.keys()
sorted_keys.sort()
for filter in sorted_keys:
filters.append((self.distro.filters_primary[filter][0],
False,
self.distro.filters_primary[filter][1],
filter))
# Load the secondary filters of the distro if available and add
# a separator
if self.distro.filters_secondary:
filters.append(("separator", True, "separator", -1))
sorted_keys = self.distro.filters_secondary.keys()
sorted_keys.sort()
for filter in sorted_keys:
filters.append((self.distro.filters_secondary[filter][0],
False,
self.distro.filters_secondary[filter][1],
filter))
# Do not show the installed applications filter in installer only mode
if not self.activation_style.isInstallerOnly:
filters.extend([("separator", True, "separator", -1),