]>
Commit | Line | Data |
---|---|---|
0731d691 | 1 | diff -aurN fbpanel-4.3.orig/panel.c fbpanel-4.3/panel.c |
2 | --- fbpanel-4.3.orig/panel.c 2005-05-08 09:46:40.000000000 +0200 | |
3 | +++ fbpanel-4.3/panel.c 2006-08-20 12:38:19.000000000 +0200 | |
82596e82 | 4 | @@ -9,6 +9,7 @@ |
5 | #include <locale.h> | |
6 | #include <string.h> | |
7 | #include <signal.h> | |
8 | +#include <time.h> | |
9 | ||
10 | #include "plugin.h" | |
11 | #include "panel.h" | |
12 | @@ -18,6 +19,11 @@ | |
13 | #include "gtkbgbox.h" | |
14 | ||
15 | static gchar *cfgfile = NULL; | |
16 | +time_t last_config_poll = 0; | |
17 | + | |
18 | +/* Array of config files to watch */ | |
19 | +GArray *config_files = NULL; | |
20 | + | |
21 | static gchar version[] = VERSION; | |
22 | gchar *cprofile = "default"; | |
23 | ||
0731d691 | 24 | @@ -243,6 +249,26 @@ |
82596e82 | 25 | panel_configure_event (GtkWidget *widget, GdkEventConfigure *e, panel *p) |
26 | { | |
27 | ENTER; | |
28 | + | |
29 | + if ((time(NULL) - last_config_poll) > 10) | |
30 | + { | |
31 | + int i; | |
32 | + struct stat cfgstat; | |
33 | + watched_file f; | |
34 | + | |
35 | + for (i = 0; i < config_files->len; i++) | |
36 | + { | |
37 | + f = g_array_index(config_files, watched_file, i); | |
38 | + stat(f.filename, &cfgstat); | |
39 | + if (cfgstat.st_mtime > f.mtime) | |
40 | + { | |
41 | + gtk_main_quit(); | |
42 | + } | |
43 | + } | |
44 | + | |
45 | + last_config_poll = time(NULL); | |
46 | + } | |
47 | + | |
48 | if (e->width == p->cw && e->height == p->ch && e->x == p->cx && e->y == p->cy) | |
49 | RET(TRUE); | |
50 | p->cw = e->width; | |
0731d691 | 51 | @@ -700,17 +726,25 @@ |
52 | fp = fopen(fname, "r"); | |
53 | LOG(LOG_INFO, " %s %s\n", fname, fp ? "ok" : "no"); | |
54 | if (fp) { | |
82596e82 | 55 | + watched_file f; |
56 | + f.filename = fname; | |
57 | + f.mtime = time(NULL); | |
58 | + g_array_append_val(config_files, f); | |
59 | cfgfile = fname; | |
0731d691 | 60 | RET(fp); |
61 | } | |
82596e82 | 62 | //ERR("Can't load %s\n", fname); |
63 | g_free(fname); | |
64 | ||
65 | - /* check private configuration directory */ | |
66 | - fname = g_strdup_printf("%s/share/fbpanel/%s", PREFIX, profile); | |
67 | + /* check system-wide configuration directory */ | |
68 | + fname = g_strdup_printf("/etc/fbpanel/%s", profile); | |
0731d691 | 69 | fp = fopen(fname, "r"); |
70 | LOG(LOG_INFO, " %s %s\n", fname, fp ? "ok" : "no"); | |
71 | if (fp) { | |
82596e82 | 72 | + watched_file f; |
73 | + f.filename = fname; | |
74 | + f.mtime = time(NULL); | |
75 | + g_array_append_val(config_files, f); | |
76 | cfgfile = fname; | |
0731d691 | 77 | RET(fp); |
78 | } | |
79 | @@ -791,6 +825,19 @@ | |
80 | } | |
81 | signal(SIGUSR1, sig_usr); | |
82596e82 | 82 | do { |
82596e82 | 83 | + if (config_files) |
84 | + { | |
0731d691 | 85 | + int i; |
86 | + watched_file w; | |
87 | + for (i = 0; i < config_files->len; i++) | |
88 | + { | |
89 | + w = g_array_index(config_files, watched_file, i); | |
90 | + g_free(w.filename); | |
91 | + } | |
92 | + g_array_free(config_files, TRUE); | |
93 | + } | |
82596e82 | 94 | + config_files = g_array_new(FALSE, FALSE, sizeof(watched_file)); |
0731d691 | 95 | + |
82596e82 | 96 | if (!(pfp = open_profile(cprofile))) |
97 | exit(1); | |
98 | p = g_new0(panel, 1); | |
0731d691 | 99 | diff -aurN fbpanel-4.3.orig/panel.h fbpanel-4.3/panel.h |
100 | --- fbpanel-4.3.orig/panel.h 2005-05-07 12:26:55.000000000 +0200 | |
101 | +++ fbpanel-4.3/panel.h 2006-08-20 12:38:19.000000000 +0200 | |
102 | @@ -96,6 +96,13 @@ | |
82596e82 | 103 | |
104 | extern command commands[]; | |
105 | ||
106 | +typedef struct { | |
107 | + gchar *filename; | |
108 | + time_t mtime; | |
109 | +} watched_file; | |
110 | + | |
111 | +extern GArray *config_files; | |
112 | + | |
113 | extern gchar *cprofile; | |
114 | ||
115 | extern Atom a_UTF8_STRING; | |
0731d691 | 116 | diff -aurN fbpanel-4.3.orig/plugin.c fbpanel-4.3/plugin.c |
117 | --- fbpanel-4.3.orig/plugin.c 2005-05-29 06:02:03.000000000 +0200 | |
118 | +++ fbpanel-4.3/plugin.c 2006-08-20 12:38:19.000000000 +0200 | |
119 | @@ -137,7 +137,7 @@ | |
120 | LOG(LOG_INFO, " %s ... %s\n", str->str, m ? "ok" : "no"); | |
82596e82 | 121 | if (!m) { |
0731d691 | 122 | DBG("error is %s\n", g_module_error()); |
82596e82 | 123 | - g_string_printf(str, "%s/share/fbpanel/plugins/%s.so", PREFIX, type); |
124 | + g_string_printf(str, "%s/lib/fbpanel/plugins/%s.so", PREFIX, type); | |
0731d691 | 125 | m = g_module_open(str->str, G_MODULE_BIND_LAZY); |
126 | LOG(LOG_INFO, " %s ... %s\n", str->str, m ? "ok" : "no"); | |
127 | if (!m) { | |
128 | diff -aurN fbpanel-4.3.orig/plugins/menu.c fbpanel-4.3/plugins/menu.c | |
129 | --- fbpanel-4.3.orig/plugins/menu.c 2005-05-21 06:58:55.000000000 +0200 | |
130 | +++ fbpanel-4.3/plugins/menu.c 2006-08-20 12:38:19.000000000 +0200 | |
131 | @@ -247,9 +247,13 @@ | |
82596e82 | 132 | } |
82596e82 | 133 | } |
0731d691 | 134 | if ((fp = fopen(name, "r"))) { |
82596e82 | 135 | + watched_file f; |
0731d691 | 136 | LOG(LOG_INFO, "Including %s\n", name); |
137 | m->files = g_slist_prepend(m->files, p->fp); | |
138 | p->fp = fp; | |
82596e82 | 139 | + f.filename = name; |
140 | + f.mtime = time(NULL); | |
141 | + g_array_append_val(config_files, f); | |
0731d691 | 142 | } else { |
82596e82 | 143 | ERR("Can't include %s\n", name); |
82596e82 | 144 | } |