~ubuntu-core-dev/update-notifier/ubuntu

« back to all changes in this revision

Viewing changes to src/update-notifier.h

  • Committer: Balint Reczey
  • Date: 2020-06-11 18:46:02 UTC
  • Revision ID: balint.reczey@canonical.com-20200611184602-2rv1zan3xu723x2u
Moved to git at https://git.launchpad.net/update-notifier

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* update-notifier.h
2
 
 * Copyright (C) 2004 Michiel Sikkes <michiel@eyesopened.nl>
3
 
 *
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.
8
 
 *
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.
13
 
 *
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.
18
 
 */
19
 
 
20
 
#ifndef __UPGRADE_NOTIFIER_H__
21
 
#define __UPGRADE_NOTIFIER_H__
22
 
 
23
 
#include <gtk/gtk.h>
24
 
#include <glib/gi18n.h>
25
 
 
26
 
#include "config.h"
27
 
 
28
 
#ifdef HAVE_APP_INDICATOR
29
 
#include <libappindicator/app-indicator.h>
30
 
#endif
31
 
 
32
 
#define CLIPBOARD_NAME  "UPGRADE_NOTIFIER_SELECTION"
33
 
 
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"
41
 
 
42
 
#define SETTINGS_UM_SCHEMA "com.ubuntu.update-manager"
43
 
#define SETTINGS_UM_KEY_LAST_LAUNCH "launch-time"
44
 
 
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"
54
 
 
55
 
// security update autolaunch minimal time (12h)
56
 
#define AUTOLAUNCH_MINIMAL_SECURITY_INTERVAL 12*60*60
57
 
 
58
 
// this is the age that we tolerate for updates (7 days)
59
 
#define OUTDATED_NAG_AGE 60*60*24*7
60
 
 
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
64
 
 
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
68
 
 
69
 
// cache-changed plugin dir
70
 
#define CACHE_CHANGED_PLUGIN_DIR "/usr/share/update-notifier/plugins/cache-changed"
71
 
 
72
 
#if 0
73
 
// testing
74
 
#define OUTDATED_NAG_AGE 60*60
75
 
#define OUTDATED_NAG_WAIT 6
76
 
#endif
77
 
 
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);
81
 
 
82
 
typedef struct _TrayApplet TrayApplet;
83
 
typedef struct _UpgradeNotifier UpgradeNotifier;
84
 
 
85
 
struct _TrayApplet 
86
 
{
87
 
   GObject me;
88
 
   UpgradeNotifier *un;
89
 
#ifdef HAVE_APP_INDICATOR
90
 
   AppIndicator *indicator;
91
 
#else
92
 
   GtkStatusIcon *tray_icon;
93
 
#endif
94
 
   GtkWidget *menu;
95
 
   char *name;
96
 
   void *user_data;
97
 
};
98
 
 
99
 
struct _UpgradeNotifier
100
 
{
101
 
   GSettings *settings;
102
 
 
103
 
   TrayApplet *update;
104
 
   TrayApplet *hook;
105
 
   TrayApplet *crashreport;
106
 
   TrayApplet *livepatch;
107
 
 
108
 
   guint update_finished_timer;
109
 
 
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;
114
 
 
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;
121
 
 
122
 
};
123
 
 
124
 
#endif /* __UPGRADE_NOTIFIER_H__ */