diff -aurN fbpanel-4.3.orig/panel.c fbpanel-4.3/panel.c --- fbpanel-4.3.orig/panel.c 2005-05-08 09:46:40.000000000 +0200 +++ fbpanel-4.3/panel.c 2006-08-20 12:38:19.000000000 +0200 @@ -9,6 +9,7 @@ #include #include #include +#include #include "plugin.h" #include "panel.h" @@ -18,6 +19,11 @@ #include "gtkbgbox.h" static gchar *cfgfile = NULL; +time_t last_config_poll = 0; + +/* Array of config files to watch */ +GArray *config_files = NULL; + static gchar version[] = VERSION; gchar *cprofile = "default"; @@ -243,6 +249,26 @@ panel_configure_event (GtkWidget *widget, GdkEventConfigure *e, panel *p) { ENTER; + + if ((time(NULL) - last_config_poll) > 10) + { + int i; + struct stat cfgstat; + watched_file f; + + for (i = 0; i < config_files->len; i++) + { + f = g_array_index(config_files, watched_file, i); + stat(f.filename, &cfgstat); + if (cfgstat.st_mtime > f.mtime) + { + gtk_main_quit(); + } + } + + last_config_poll = time(NULL); + } + if (e->width == p->cw && e->height == p->ch && e->x == p->cx && e->y == p->cy) RET(TRUE); p->cw = e->width; @@ -700,17 +726,25 @@ fp = fopen(fname, "r"); LOG(LOG_INFO, " %s %s\n", fname, fp ? "ok" : "no"); if (fp) { + watched_file f; + f.filename = fname; + f.mtime = time(NULL); + g_array_append_val(config_files, f); cfgfile = fname; RET(fp); } //ERR("Can't load %s\n", fname); g_free(fname); - /* check private configuration directory */ - fname = g_strdup_printf("%s/share/fbpanel/%s", PREFIX, profile); + /* check system-wide configuration directory */ + fname = g_strdup_printf("/etc/fbpanel/%s", profile); fp = fopen(fname, "r"); LOG(LOG_INFO, " %s %s\n", fname, fp ? "ok" : "no"); if (fp) { + watched_file f; + f.filename = fname; + f.mtime = time(NULL); + g_array_append_val(config_files, f); cfgfile = fname; RET(fp); } @@ -791,6 +825,19 @@ } signal(SIGUSR1, sig_usr); do { + if (config_files) + { + int i; + watched_file w; + for (i = 0; i < config_files->len; i++) + { + w = g_array_index(config_files, watched_file, i); + g_free(w.filename); + } + g_array_free(config_files, TRUE); + } + config_files = g_array_new(FALSE, FALSE, sizeof(watched_file)); + if (!(pfp = open_profile(cprofile))) exit(1); p = g_new0(panel, 1); diff -aurN fbpanel-4.3.orig/panel.h fbpanel-4.3/panel.h --- fbpanel-4.3.orig/panel.h 2005-05-07 12:26:55.000000000 +0200 +++ fbpanel-4.3/panel.h 2006-08-20 12:38:19.000000000 +0200 @@ -96,6 +96,13 @@ extern command commands[]; +typedef struct { + gchar *filename; + time_t mtime; +} watched_file; + +extern GArray *config_files; + extern gchar *cprofile; extern Atom a_UTF8_STRING; diff -aurN fbpanel-4.3.orig/plugin.c fbpanel-4.3/plugin.c --- fbpanel-4.3.orig/plugin.c 2005-05-29 06:02:03.000000000 +0200 +++ fbpanel-4.3/plugin.c 2006-08-20 12:38:19.000000000 +0200 @@ -137,7 +137,7 @@ LOG(LOG_INFO, " %s ... %s\n", str->str, m ? "ok" : "no"); if (!m) { DBG("error is %s\n", g_module_error()); - g_string_printf(str, "%s/share/fbpanel/plugins/%s.so", PREFIX, type); + g_string_printf(str, "%s/lib/fbpanel/plugins/%s.so", PREFIX, type); m = g_module_open(str->str, G_MODULE_BIND_LAZY); LOG(LOG_INFO, " %s ... %s\n", str->str, m ? "ok" : "no"); if (!m) { diff -aurN fbpanel-4.3.orig/plugins/menu.c fbpanel-4.3/plugins/menu.c --- fbpanel-4.3.orig/plugins/menu.c 2005-05-21 06:58:55.000000000 +0200 +++ fbpanel-4.3/plugins/menu.c 2006-08-20 12:38:19.000000000 +0200 @@ -247,9 +247,13 @@ } } if ((fp = fopen(name, "r"))) { + watched_file f; LOG(LOG_INFO, "Including %s\n", name); m->files = g_slist_prepend(m->files, p->fp); p->fp = fp; + f.filename = name; + f.mtime = time(NULL); + g_array_append_val(config_files, f); } else { ERR("Can't include %s\n", name); }