2
* Copyright (C) 2004 Michiel Sikkes <michiel@eyesopened.nl>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor
17
* Boston, MA 02110-1301 USA.
20
#ifndef __UPGRADE_NOTIFIER_H__
21
#define __UPGRADE_NOTIFIER_H__
24
#include <glib/gi18n.h>
28
#ifdef HAVE_APP_INDICATOR
29
#include <libappindicator/app-indicator.h>
32
#define CLIPBOARD_NAME "UPGRADE_NOTIFIER_SELECTION"
34
#define SETTINGS_SCHEMA "com.ubuntu.update-notifier"
35
#define SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS "no-show-notifications"
36
#define SETTINGS_KEY_APPORT_NOTIFICATIONS "show-apport-crashes"
37
#define SETTINGS_KEY_END_SYSTEM_UIDS "end-system-uids"
38
#define SETTINGS_KEY_AUTO_LAUNCH_INTERVAL "regular-auto-launch-interval"
39
#define SETTINGS_KEY_LAST_RELEASE_CHECK "release-check-time"
40
#define SETTINGS_KEY_SHOW_LIVEPATCH_ICON "show-livepatch-status-icon"
42
#define SETTINGS_UM_SCHEMA "com.ubuntu.update-manager"
43
#define SETTINGS_UM_KEY_LAST_LAUNCH "launch-time"
45
#define HOOKS_DIR "/var/lib/update-notifier/user.d/"
46
#define CRASHREPORT_HELPER "/usr/share/apport/apport-checkreports"
47
#define CRASHREPORT_REPORT_APP "/usr/share/apport/apport-gtk"
48
#define CRASHREPORT_DIR "/var/crash/"
49
#define CRASHREPORT_AUTOREPORT "/var/lib/apport/autoreport"
50
#define CRASHREPORT_WHOOPSIE_EXEC "/usr/bin/whoopsie"
51
#define CRASHREPORT_WHOOPSIE_SERVICE "whoopsie"
52
#define UNICAST_LOCAL_AVAHI_FILE "/run/avahi-daemon/disabled-for-unicast-local"
53
#define LIVEPATCH_FILE "/var/snap/canonical-livepatch/current/status"
55
// security update autolaunch minimal time (12h)
56
#define AUTOLAUNCH_MINIMAL_SECURITY_INTERVAL 12*60*60
58
// this is the age that we tolerate for updates (7 days)
59
#define OUTDATED_NAG_AGE 60*60*24*7
61
// this is the time we wait when we found outdated information for
62
// anacron(and friends) to update the system (2h)
63
#define OUTDATED_NAG_WAIT 60*60*2
65
// this is the script and the time to run the release-upgrades checker
66
#define RELEASE_UPGRADE_CHECKER "/usr/lib/ubuntu-release-upgrader/check-new-release-gtk"
67
#define RELEASE_UPGRADE_CHECK_WAIT 60*60*24*14
69
// cache-changed plugin dir
70
#define CACHE_CHANGED_PLUGIN_DIR "/usr/share/update-notifier/plugins/cache-changed"
74
#define OUTDATED_NAG_AGE 60*60
75
#define OUTDATED_NAG_WAIT 6
78
void invoke_with_pkexec(const gchar *cmd);
79
void invoke(const gchar *cmd, const gchar *desktop, gboolean with_pkexec);
80
gboolean in_admin_group(void);
82
typedef struct _TrayApplet TrayApplet;
83
typedef struct _UpgradeNotifier UpgradeNotifier;
89
#ifdef HAVE_APP_INDICATOR
90
AppIndicator *indicator;
92
GtkStatusIcon *tray_icon;
99
struct _UpgradeNotifier
105
TrayApplet *crashreport;
106
TrayApplet *livepatch;
108
guint update_finished_timer;
110
// some states for the file montioring (these field
111
// are the state for the current "time-slice")
112
gboolean dpkg_was_run;
113
gboolean apt_get_running;
115
// these field are "global" (time-wise)
116
gboolean hook_pending;
117
gboolean crashreport_pending;
118
gboolean unicast_local_avahi_pending;
119
gboolean livepatch_pending;
120
time_t last_apt_action;
124
#endif /* __UPGRADE_NOTIFIER_H__ */