1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/* update-notifier.h
* Copyright (C) 2004 Michiel Sikkes <michiel@eyesopened.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor
* Boston, MA 02110-1301 USA.
*/
#ifndef __UPGRADE_NOTIFIER_H__
#define __UPGRADE_NOTIFIER_H__
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
#define CLIPBOARD_NAME "UPGRADE_NOTIFIER_SELECTION"
#define GCONF_KEY_DEFAULT_ACTION "/apps/update-notifier/default_action"
#define GCONF_KEY_NO_UPDATE_NOTIFICATIONS "/apps/update-notifier/no_show_notifications"
#define GCONF_KEY_APPORT_NOTIFICATIONS "/apps/update-notifier/show_apport_crashes"
#define GCONF_KEY_END_SYSTEM_UIDS "/apps/update-notifier/end_system_uids"
#define GCONF_KEY_AUTO_LAUNCH "/apps/update-notifier/auto_launch"
#define GCONF_KEY_AUTO_LAUNCH_INTERVAL "/apps/update-notifier/regular_auto_launch_interval"
#define GCONF_KEY_HIDE_REBOOT "/apps/update-notifier/hide_reboot_notification"
#define GCONF_KEY_LAST_LAUNCH "/apps/update-manager/launch_time"
#define GCONF_KEY_LAST_RELEASE_CHECK "/apps/update-notifier/release_check_time"
#define HOOKS_DIR "/var/lib/update-notifier/user.d/"
#define CRASHREPORT_HELPER "/usr/share/apport/apport-checkreports"
#define CRASHREPORT_REPORT_APP "/usr/share/apport/apport-gtk"
#define CRASHREPORT_DIR "/var/crash/"
#define REBOOT_FILE "/var/run/reboot-required"
#define UNICAST_LOCAL_AVAHI_FILE "/var/run/avahi-daemon/disabled-for-unicast-local"
// security update autolaunch minimal time (12h)
#define AUTOLAUNCH_MINIMAL_SECURITY_INTERVAL 12*60*60
// this is the age that we tolerate for updates (7 dayd)
#define OUTDATED_NAG_AGE 60*60*24*7
// this is the time we wait when we found outdated information for
// anacron(and friends) to update the system (2h)
#define OUTDATED_NAG_WAIT 60*60*2
// this is the script and the time to run the release-upgrades checker
#define RELEASE_UPGRADE_CHECKER "/usr/lib/update-manager/check-new-release-gtk"
#define RELEASE_UPGRADE_CHECK_WAIT 60*60*24*2
// cache-changed plugin dir
#define CACHE_CHANGED_PLUGIN_DIR "/usr/share/update-notifier/plugins/cache-changed"
#if 0
// testing
#define OUTDATED_NAG_AGE 60*60
#define OUTDATED_NAG_WAIT 6
#endif
void invoke_with_gksu(const gchar *cmd, const gchar *descr, gboolean whole_message);
void invoke(const gchar *cmd, const gchar *desktop, gboolean with_gksu);
gboolean in_admin_group();
typedef struct _TrayApplet TrayApplet;
struct _TrayApplet
{
GtkStatusIcon *tray_icon;
GtkWidget *menu;
char *name;
void *user_data;
};
typedef struct _UpgradeNotifier UpgradeNotifier;
struct _UpgradeNotifier
{
TrayApplet *update;
TrayApplet *reboot;
TrayApplet *hook;
TrayApplet *crashreport;
GConfClient *gconf;
guint update_finished_timer;
// some states for the file montioring (these field
// are the state for the current "time-slice")
gboolean dpkg_was_run;
gboolean apt_get_runing;
// these field are "global" (time-wise)
gboolean reboot_pending;
gboolean hook_pending;
gboolean crashreport_pending;
gboolean unicast_local_avahi_pending;
time_t last_apt_action;
};
#endif /* __UPGRADE_NOTIFIER_H__ */
|