Commit 3eb5c683 authored by Richard Hughes's avatar Richard Hughes
Browse files

Remove the gpk-update-icon process, the functionality has been moved to gnome-settings-daemon

parent 3cdd1859
......@@ -24,9 +24,6 @@ desktop_in_files = \
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
autostartdir = $(datadir)/gnome/autostart
autostart_in_files = gpk-update-icon.desktop.in
autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
pkgdata_DATA = \
gpk-eula.ui \
......@@ -68,7 +65,6 @@ DISTCLEANFILES = \
gpk-install-catalog.desktop \
gpk-install-file.desktop \
gpk-log.desktop \
gpk-update-icon.desktop \
gpk-application.desktop \
gpk-distro-upgrade.desktop \
org.freedesktop.PackageKit.service \
......
[Desktop Entry]
_Name=PackageKit Update Applet
_Comment=PackageKit Update Applet
Icon=system-software-update
Exec=gpk-update-icon
Terminal=false
Type=Application
Categories=
NotShowIn=KDE;
[org.gnome.packagekit]
enable-check-firmware = /apps/gnome-packagekit/enable_check_firmware
banned-firmware = /apps/gnome-packagekit/update-icon/banned_firmware
ignored-devices = /apps/gnome-packagekit/update-icon/ignored_devices
ignored-messages = /apps/gnome-packagekit/update-icon/ignored_messages
enable-check-hardware = /apps/gnome-packagekit/enable_check_hardware
enable-autoremove = /apps/gnome-packagekit/enable_autoremove
show-depends = /apps/gnome-packagekit/show_depends
show-copy-confirm = /apps/gnome-packagekit/show_copy_confirm
notify-update-failed = /apps/gnome-packagekit/update-icon/notify_update_failed
notify-update-complete = /apps/gnome-packagekit/update-icon/notify_update_complete
notify-update-complete-restart = /apps/gnome-packagekit/update-icon/notify_update_complete_restart
notify-update-not-battery = /apps/gnome-packagekit/update-icon/notify_update_not_battery
notify-update-started = /apps/gnome-packagekit/update-icon/notify_update_started
notify-message = /apps/gnome-packagekit/update-icon/notify_message
notify-errors = /apps/gnome-packagekit/update-icon/notify_errors
notify-complete = /apps/gnome-packagekit/update-icon/notify_complete
notify-available = /apps/gnome-packagekit/update-icon/notify_available
notify-distro-upgrades = /apps/gnome-packagekit/update-icon/notify_distro_upgrades
notify-critical = /apps/gnome-packagekit/update-icon/notify_critical
connection-use-mobile = /apps/gnome-packagekit/update-icon/connection_use_mobile
connection-use-wifi = /apps/gnome-packagekit/update-icon/connection_use_wifi
watch-active-transactions = /apps/gnome-packagekit/update-icon/watch_active_transactions
autocomplete = /apps/gnome-packagekit/autocomplete
session-startup-timeout = /apps/gnome-packagekit/update-icon/session_startup_timeout
force-get-updates-login = /apps/gnome-packagekit/update-icon/force_get_updates_login
frequency-get-updates = /apps/gnome-packagekit/update-icon/frequency_get_updates
frequency-get-upgrades = /apps/gnome-packagekit/update-icon/frequency_get_upgrades
frequency-refresh-cache = /apps/gnome-packagekit/update-icon/frequency_refresh_cache
update-battery = /apps/gnome-packagekit/update-icon/update_battery
filter-basename = /apps/gnome-packagekit/application/filter_basename
filter-newest = /apps/gnome-packagekit/application/filter_newest
filter-arch = /apps/gnome-packagekit/application/filter_arch
......@@ -43,6 +19,3 @@ enable-codec-helper = /apps/gnome-packagekit/enable_codec_helper
enable-mime-type-helper = /apps/gnome-packagekit/enable_mime_type_helper
dbus-default-interaction = /apps/gnome-packagekit/dbus_default_interaction
dbus-enforced-interaction = /apps/gnome-packagekit/dbus_enforced_interaction
install-root = /apps/gnome-packagekit/install_root
media-repo-filenames = /apps/gnome-packagekit/media_repo_filenames
<schemalist>
<enum id="org.gnome.packagekit.AutoUpdateType">
<value nick="all" value="0"/>
<value nick="security" value="1"/>
<value nick="none" value="2"/>
</enum>
<enum id="org.gnome.packagekit.SearchType">
<value nick="name" value="0"/>
<value nick="details" value="1"/>
<value nick="file" value="2"/>
</enum>
<schema id="org.gnome.packagekit" path="/apps/gnome-packagekit/">
<key name="enable-check-firmware" type="b">
<default>true</default>
<summary>Ask the user if additional firmware should be installed</summary>
<description>Ask the user if additional firmware should be installed.</description>
</key>
<key name="banned-firmware" type="s">
<default>'*/intel-ucode/*'</default>
<summary>Firmware files that should not be searched for</summary>
<description>Firmware files that should not be searched for, separated by commas. These can include '*' and '?' characters.</description>
</key>
<key name="ignored-devices" type="s">
<default>''</default>
<summary>Devices that should be ignored</summary>
<description>Devices that should be ignored, separated by commas. These can include '*' and '?' characters.</description>
</key>
<key name="ignored-messages" type="s">
<default>'backend-*,untrusted-package,other-updates-held-back,repo-metadata-download-failed'</default>
<summary>Messages that should be ignored</summary>
<description>Messages that should be ignored, separated by commas. These can include '*' and '?' characters.</description>
</key>
<key name="enable-check-hardware" type="b">
<default>false</default>
<summary>Ask the user if additional hardware drivers should be installed</summary>
<description>Ask the user if additional hardware drivers should be installed.</description>
</key>
<key name="enable-autoremove" type="b">
<default>false</default>
<summary>Automatically remove unused dependencies</summary>
......@@ -50,111 +20,11 @@
<summary>Ask the user if files should be copied to a non-private directory</summary>
<description>Ask the user if files should be copied to a non-private directory when installing from a FUSE mount.</description>
</key>
<key name="notify-update-failed" type="b">
<default>true</default>
<summary>Notify the user when an update has failed</summary>
<description>Notify the user when an update has failed.</description>
</key>
<key name="notify-update-complete" type="b">
<default>false</default>
<summary>Notify the user for completed updates</summary>
<description>Notify the user for completed updates.</description>
</key>
<key name="notify-update-complete-restart" type="b">
<default>true</default>
<summary>Notify the user for completed updates where the user needs to restart</summary>
<description>Notify the user for completed updates where the user needs to restart.</description>
</key>
<key name="notify-update-not-battery" type="b">
<default>false</default>
<summary>Notify the user when the automatic update was not started on battery power</summary>
<description>Notify the user when the update was not automatically started while running on battery power.</description>
</key>
<key name="notify-update-started" type="b">
<default>true</default>
<summary>Notify the user when the update was started</summary>
<description>Notify the user when the update was started.</description>
</key>
<key name="notify-message" type="b">
<default>false</default>
<summary>Notify the user when there are messages</summary>
<description>Notify the user when there are messages from the package manager.</description>
</key>
<key name="notify-errors" type="b">
<default>true</default>
<summary>Notify the user when there are errors</summary>
<description>Notify the user when there are errors.</description>
</key>
<key name="notify-complete" type="b">
<default>true</default>
<summary>Notify the user when a task is complete</summary>
<description>Notify the user when a task is complete.</description>
</key>
<key name="notify-available" type="b">
<default>true</default>
<summary>Notify the user when updates are available</summary>
<description>Notify the user when updates are available.</description>
</key>
<key name="notify-distro-upgrades" type="b">
<default>true</default>
<summary>Notify the user when distribution upgrades are available</summary>
<description>Notify the user when distribution upgrades are available.</description>
</key>
<key name="notify-critical" type="b">
<default>true</default>
<summary>Notify the user when security updates are available</summary>
<description>Notify the user when security updates are available.</description>
</key>
<key name="connection-use-mobile" type="b">
<default>false</default>
<summary>Use mobile broadband connections</summary>
<description>Use mobile broadband connections such as GSM and CDMA to check for updates.</description>
</key>
<key name="connection-use-wifi" type="b">
<default>true</default>
<summary>Use WiFi connections</summary>
<description>Use WiFi (wireless LAN) connections to check for updates.</description>
</key>
<key name="autocomplete" type="b">
<default>false</default>
<summary>If search terms should be completed automatically</summary>
<description>If search terms should be completed automatically.</description>
</key>
<key name="session-startup-timeout" type="i">
<default>300</default>
<summary>The number of seconds at session startup to wait before checking for updates</summary>
<description>The number of seconds at session startup to wait before checking for updates.</description>
</key>
<key name="force-get-updates-login" type="b">
<default>false</default>
<summary>Get the update list when the session starts</summary>
<description>Get the update list when the session starts, even if not scheduled to. This ensures the user has up to date and valid data in the tray at startup.</description>
</key>
<key name="frequency-get-updates" type="i">
<default>86400</default>
<summary>How often to check for updates</summary>
<description>How often to check for updates. Value is in seconds.</description>
</key>
<key name="frequency-get-upgrades" type="i">
<default>604800</default>
<summary>How often to check for distribution upgrades</summary>
<description>How often to check for distribution upgrades. Value is in seconds.</description>
</key>
<key name="frequency-refresh-cache" type="i">
<default>86400</default>
<summary>How often to refresh the package cache</summary>
<description>How often to refresh the package cache. Value is in seconds.</description>
</key>
<key name="auto-update" enum="org.gnome.packagekit.AutoUpdateType">
<default>'none'</default>
<summary>Automatically update these types of updates</summary>
<description>Automatically update these types of updates.</description>
</key>
<key name="update-battery" type="b">
<default>false</default>
<summary>Install updates automatically when running on battery power</summary>
<description>Install updates automatically when running on battery power.</description>
</key>
<key name="filter-basename" type="b">
<default>false</default>
<summary>Filter using basename in gpk-application</summary>
......@@ -233,11 +103,6 @@
<default>'show-confirm-install'</default>
<description>When displaying UI from a session DBus request, force these options to be turned on.</description>
</key>
<key name="media-repo-filenames" type="s">
<default>'media.repo,.discinfo'</default>
<summary>The filenames on removable media that designate it important.</summary>
<description>When removable media is inserted, it is checked to see if it contains any important filenames in the root directory. If the filename matches, then an updates check is performed. This allows post-install disks to be used to update running systems.</description>
</key>
</schema>
<schema id="org.gnome.settings-daemon" path="/apps/gnome-settings-daemon/">
<child name="gtk-modules" schema="gnome-settings-daemon.gtk-modules"/>
......
......@@ -16,13 +16,11 @@ data/gpk-prefs.desktop.in
[type: gettext/glade]data/gpk-service-pack.desktop.in
[type: gettext/glade]data/gpk-service-pack.ui
[type: gettext/glade]data/gpk-signature.ui
data/gpk-update-icon.desktop.in
data/gpk-update-viewer.desktop.in
data/gpk-distro-upgrade.desktop.in
[type: gettext/glade]data/gpk-update-viewer.ui
python/packagekit/gtkwidgets.py
src/gpk-application.c
src/gpk-check-update.c
src/gpk-common.c
src/gpk-dbus-task.c
src/gpk-desktop.c
......@@ -30,12 +28,9 @@ src/gpk-dialog.c
src/gpk-distro-upgrade.c
src/gpk-enum.c
src/gpk-error.c
src/gpk-firmware.c
src/gpk-hardware.c
src/gpk-helper-chooser.c
src/gpk-task.c
src/gpk-helper-run.c
src/gpk-inhibit.c
src/gpk-install-catalog.c
src/gpk-install-local-file.c
src/gpk-install-mime-type.c
......@@ -45,9 +40,6 @@ src/gpk-log.c
src/gpk-modal-dialog.c
src/gpk-prefs.c
src/gpk-service-pack.c
src/gpk-update-icon.c
src/gpk-update-viewer.c
src/gpk-dbus-service.c
src/gpk-watch.c
src/gpk-debug.c
......@@ -38,7 +38,6 @@ bin_PROGRAMS = \
gpk-install-mime-type \
gpk-install-provide-file \
gpk-install-package-name \
gpk-update-icon \
gpk-update-viewer \
gpk-log \
gpk-dbus-service \
......@@ -157,27 +156,6 @@ gpk_distro_upgrade_LDADD = \
libgpkshared.a \
$(shared_LIBS)
gpk_update_icon_SOURCES = \
gpk-update-icon.c \
gpk-check-update.c \
gpk-check-update.h \
gpk-auto-refresh.c \
gpk-auto-refresh.h \
gpk-watch.c \
gpk-watch.h \
gpk-firmware.c \
gpk-firmware.h \
gpk-hardware.c \
gpk-hardware.h \
gpk-inhibit.c \
gpk-inhibit.h \
$(NULL)
gpk_update_icon_LDADD = \
libgpkshared.a \
$(shared_LIBS) \
$(NULL)
gpk_dbus_service_SOURCES = \
gpk-dbus-service.c \
gpk-dbus.c \
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2007-2008 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include <glib/gi18n.h>
#include <packagekit-glib2/packagekit.h>
#include <libupower-glib/upower.h>
#include "egg-string.h"
#include "gpk-common.h"
#include "gpk-session.h"
#include "gpk-auto-refresh.h"
#include "gpk-enum.h"
static void gpk_auto_refresh_finalize (GObject *object);
#define GPK_AUTO_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_AUTO_REFRESH, GpkAutoRefreshPrivate))
#define GPK_AUTO_REFRESH_PERIODIC_CHECK 60*60 /* force check for updates every this much time */
#define GPK_UPDATES_LOGIN_TIMEOUT 3 /* seconds */
/*
* at startup, after a small delay, force a GetUpdates call
* every hour (or any event) check:
- if we are online, idle and on AC power, it's been more than a day since we refreshed then RefreshCache
- if we are online and it's been longer than the timeout since getting the updates period then GetUpdates
*/
struct GpkAutoRefreshPrivate
{
gboolean session_idle;
gboolean on_battery;
gboolean network_active;
gboolean force_get_updates_login;
guint force_get_updates_login_timeout_id;
guint timeout_id;
guint periodic_id;
UpClient *client;
GSettings *settings;
GpkSession *session;
PkControl *control;
};
enum {
REFRESH_CACHE,
GET_UPDATES,
GET_UPGRADES,
LAST_SIGNAL
};
static guint signals [LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GpkAutoRefresh, gpk_auto_refresh, G_TYPE_OBJECT)
/**
* gpk_auto_refresh_class_init:
* @klass: The GpkAutoRefreshClass
**/
static void
gpk_auto_refresh_class_init (GpkAutoRefreshClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gpk_auto_refresh_finalize;
g_type_class_add_private (klass, sizeof (GpkAutoRefreshPrivate));
signals [REFRESH_CACHE] =
g_signal_new ("refresh-cache",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals [GET_UPDATES] =
g_signal_new ("get-updates",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals [GET_UPGRADES] =
g_signal_new ("get-upgrades",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
/**
* gpk_auto_refresh_signal_refresh_cache:
**/
static gboolean
gpk_auto_refresh_signal_refresh_cache (GpkAutoRefresh *arefresh)
{
g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
g_debug ("emitting refresh-cache");
g_signal_emit (arefresh, signals [REFRESH_CACHE], 0);
return TRUE;
}
/**
* gpk_auto_refresh_signal_get_updates:
**/
static gboolean
gpk_auto_refresh_signal_get_updates (GpkAutoRefresh *arefresh)
{
g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
g_debug ("emitting get-updates");
g_signal_emit (arefresh, signals [GET_UPDATES], 0);
return TRUE;
}
/**
* gpk_auto_refresh_signal_get_upgrades:
**/
static gboolean
gpk_auto_refresh_signal_get_upgrades (GpkAutoRefresh *arefresh)
{
g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
g_debug ("emitting get-upgrades");
g_signal_emit (arefresh, signals [GET_UPGRADES], 0);
return TRUE;
}
/**
* gpk_auto_refresh_get_time_refresh_cache_cb:
**/
static void
gpk_auto_refresh_get_time_refresh_cache_cb (GObject *object, GAsyncResult *res, GpkAutoRefresh *arefresh)
{
PkControl *control = PK_CONTROL (object);
GError *error = NULL;
guint seconds;
guint thresh;
/* get the result */
seconds = pk_control_get_time_since_action_finish (control, res, &error);
if (seconds == 0) {
g_warning ("failed to get time: %s", error->message);
g_error_free (error);
return;
}
/* have we passed the timout? */
thresh = g_settings_get_int (arefresh->priv->settings, GPK_SETTINGS_FREQUENCY_GET_UPDATES);
if (seconds < thresh) {
g_debug ("not before timeout, thresh=%u, now=%u", thresh, seconds);
return;
}
/* send signal */
gpk_auto_refresh_signal_refresh_cache (arefresh);
}
/**
* gpk_auto_refresh_maybe_refresh_cache:
**/
static void
gpk_auto_refresh_maybe_refresh_cache (GpkAutoRefresh *arefresh)
{
guint thresh;
g_return_if_fail (GPK_IS_AUTO_REFRESH (arefresh));
/* if we don't want to auto check for updates, don't do this either */
thresh = g_settings_get_int (arefresh->priv->settings, GPK_SETTINGS_FREQUENCY_GET_UPDATES);
if (thresh == 0) {
g_debug ("not when policy is set to never");
return;
}
/* not on battery */
if (arefresh->priv->on_battery) {
g_debug ("not when on battery");
return;
}
/* only do the refresh cache when the user is idle */
if (!arefresh->priv->session_idle) {
g_debug ("not when session active");
return;
}
/* get this each time, as it may have changed behind out back */
thresh = g_settings_get_int (arefresh->priv->settings, GPK_SETTINGS_FREQUENCY_REFRESH_CACHE);
if (thresh == 0) {
g_debug ("not when policy is set to never");
return;
}
/* get the time since the last refresh */
pk_control_get_time_since_action_async (arefresh->priv->control, PK_ROLE_ENUM_REFRESH_CACHE, NULL,
(GAsyncReadyCallback) gpk_auto_refresh_get_time_refresh_cache_cb, arefresh);
}
/**
* gpk_auto_refresh_get_time_get_updates_cb:
**/
static void
gpk_auto_refresh_get_time_get_updates_cb (GObject *object, GAsyncResult *res, GpkAutoRefresh *arefresh)
{
PkControl *control = PK_CONTROL (object);
GError *error = NULL;
guint seconds;
guint thresh;
/* get the result */
seconds = pk_control_get_time_since_action_finish (control, res, &error);
if (seconds == 0) {
g_warning ("failed to get time: %s", error->message);
g_error_free (error);
return;
}
/* have we passed the timout? */
thresh = g_settings_get_int (arefresh->priv->settings, GPK_SETTINGS_FREQUENCY_GET_UPDATES);
if (seconds < thresh) {
g_debug ("not before timeout, thresh=%u, now=%u", thresh, seconds);
return;
}
/* send signal */
gpk_auto_refresh_signal_get_updates (arefresh);
}
/**
* gpk_auto_refresh_maybe_get_updates:
**/
static void
gpk_auto_refresh_maybe_get_updates (GpkAutoRefresh *arefresh)
{
guint thresh;
g_return_if_fail (GPK_IS_AUTO_REFRESH (arefresh));
if (!arefresh->priv->force_get_updates_login) {
arefresh->priv->force_get_updates_login = TRUE;
if (g_settings_get_boolean (arefresh->priv->settings, GPK_SETTINGS_FORCE_GET_UPDATES_LOGIN)) {
g_debug ("forcing get update due to GSettings");
gpk_auto_refresh_signal_get_updates (arefresh);
return;
}
}
/* if we don't want to auto check for updates, don't do this either */
thresh = g_settings_get_int (arefresh->priv->settings, GPK_SETTINGS_FREQUENCY_GET_UPDATES);
if (thresh == 0) {
g_debug ("not when policy is set to never");
return;
}
/* get the time since the last refresh */
pk_control_get_time_since_action_async (arefresh->priv->control, PK_ROLE_ENUM_GET_UPDATES, NULL,
(GAsyncReadyCallback) gpk_auto_refresh_get_time_get_updates_cb, arefresh);
}
/**
* gpk_auto_refresh_get_time_get_upgrades_cb:
**/
static void
gpk_auto_refresh_get_time_get_upgrades_cb (GObject *object, GAsyncResult *res, GpkAutoRefresh *arefresh)
{
PkControl *control = PK_CONTROL (object);
GError *error = NULL;
guint seconds;
guint thresh;
/* get the result */
seconds = pk_control_get_time_since_action_finish (control, res, &error);
if (seconds == 0) {
g_warning ("failed to get time: %s", error->message);
g_error_free (error);
return;
}
/* have we passed the timout? */
thresh = g_settings_get_int (arefresh->priv->settings, GPK_SETTINGS_FREQUENCY_GET_UPDATES);
if (seconds < thresh) {
g_debug ("not before timeout, thresh=%u, now=%u", thresh, seconds);
return;
}
/* send signal */
gpk_auto_refresh_signal_get_upgrades (arefresh);
}
/**
* gpk_auto_refresh_maybe_get_upgrades:
**/
static void