Dump the log after loading it from the slave (dump_log): Set first_old to
2001-06-20 Bradford Hovinen <hovinen@ximian.com> * config-log.c (slave_data_cb): Dump the log after loading it from the slave (dump_log): Set first_old to the beginning of the list after the dump (do_load): Don't call do_unload (socket_data_cb): Check for hang up first
This commit is contained in:
parent
efc06f6cc7
commit
c39d6dff02
4 changed files with 36 additions and 16 deletions
|
@ -1,5 +1,14 @@
|
|||
2001-06-20 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* config-log.c (slave_data_cb): Dump the log after loading it from
|
||||
the slave
|
||||
(dump_log): Set first_old to the beginning of the list after the dump
|
||||
(do_load): Don't call do_unload
|
||||
(socket_data_cb): Check for hang up first
|
||||
|
||||
* archive.c, Makefile.am: Replace all instances of ximian-config
|
||||
with ximian-setup-tools
|
||||
|
||||
* config-log.c (slave_new): Don't apprise slave of new data
|
||||
(config_log_write_entry): Dump log after every write
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ SUBDIRS = . location-manager-capplet
|
|||
confexecdir = $(libdir)
|
||||
confexec_DATA = ximian_archiverConf.sh
|
||||
|
||||
Locationmetadir = $(datadir)/ximian-config/default
|
||||
Locationmetadir = $(datadir)/ximian-setup-tools/archiver
|
||||
Locationmeta_DATA = default-user.xml default-global.xml
|
||||
|
||||
includedir = $(prefix)/include/ximian-archiver
|
||||
|
@ -14,7 +14,7 @@ INCLUDES = \
|
|||
-DVERSION=\""$(VERSION)"\" \
|
||||
-DG_LOG_DOMAIN=\"libximian-archiver\" \
|
||||
-DCONFIGDIR=\""/etc"\" \
|
||||
-DLOCATION_DIR=\""$(datadir)/ximian-config/default"\" \
|
||||
-DLOCATION_DIR=\""$(datadir)/ximian-setup-tools/archiver"\" \
|
||||
-DGLADE_DIR=\""$(INTERFACES_DIR)"\" \
|
||||
-DXST_BACKEND_LOCATION=\""$(datadir)/ximian-setup-tools/scripts"\" \
|
||||
$(GNOME_XML_CFLAGS) \
|
||||
|
|
|
@ -237,10 +237,10 @@ archive_load (gboolean is_global)
|
|||
return GTK_OBJECT (user_archive);
|
||||
|
||||
if (is_global)
|
||||
prefix = CONFIGDIR "/ximian-config";
|
||||
prefix = "/var/ximian-setup-tools";
|
||||
else
|
||||
prefix = g_concat_dir_and_file (g_get_home_dir (),
|
||||
".gnome/ximian-config");
|
||||
".gnome/ximian-setup-tools");
|
||||
|
||||
object = gtk_object_new (archive_get_type (),
|
||||
"prefix", prefix,
|
||||
|
@ -565,11 +565,11 @@ archive_set_current_location_id (Archive *archive, const gchar *locid)
|
|||
|
||||
if (archive->is_global)
|
||||
gnome_config_set_string
|
||||
("/ximian-config/config/current/global-location",
|
||||
("/ximian-setup-tools/config/current/global-location",
|
||||
archive->current_location_id);
|
||||
else
|
||||
gnome_config_set_string
|
||||
("/ximian-config/config/current/location",
|
||||
("/ximian-setup-tools/config/current/location",
|
||||
archive->current_location_id);
|
||||
|
||||
gnome_config_sync ();
|
||||
|
@ -597,11 +597,11 @@ archive_get_current_location_id (Archive *archive)
|
|||
if (archive->is_global)
|
||||
archive->current_location_id =
|
||||
gnome_config_get_string_with_default
|
||||
("/ximian-config/config/current/global-location=default", &def);
|
||||
("/ximian-setup-tools/config/current/global-location=default", &def);
|
||||
else
|
||||
archive->current_location_id =
|
||||
gnome_config_get_string_with_default
|
||||
("/ximian-config/config/current/location=default", &def);
|
||||
("/ximian-setup-tools/config/current/location=default", &def);
|
||||
|
||||
/* Create default location if it does not exist */
|
||||
if (def && archive_get_location
|
||||
|
|
|
@ -532,6 +532,7 @@ config_log_write_entry (ConfigLog *config_log, gchar *backend_id,
|
|||
if (config_log->p->socket_owner) {
|
||||
slave_broadcast_data (NULL, config_log);
|
||||
dump_log (config_log);
|
||||
do_load (config_log);
|
||||
} else {
|
||||
write_log (config_log->p->socket_buffer, entry);
|
||||
}
|
||||
|
@ -633,6 +634,7 @@ config_log_reload (ConfigLog *config_log)
|
|||
g_return_if_fail (config_log != NULL);
|
||||
g_return_if_fail (IS_CONFIG_LOG (config_log));
|
||||
|
||||
do_unload (config_log, FALSE);
|
||||
do_load (config_log);
|
||||
}
|
||||
|
||||
|
@ -889,7 +891,6 @@ do_load (ConfigLog *config_log)
|
|||
g_return_val_if_fail (config_log->p->location != NULL, FALSE);
|
||||
g_return_val_if_fail (IS_LOCATION (config_log->p->location), FALSE);
|
||||
|
||||
do_unload (config_log, FALSE);
|
||||
config_log_reset_filenames (config_log);
|
||||
|
||||
fd = open (config_log->p->filename, O_RDONLY);
|
||||
|
@ -897,8 +898,10 @@ do_load (ConfigLog *config_log)
|
|||
if (fd != -1)
|
||||
config_log->p->file_buffer =
|
||||
io_buffer_new (g_io_channel_unix_new (fd), FALSE);
|
||||
else
|
||||
else {
|
||||
g_warning ("Could not open config log: %s", g_strerror (errno));
|
||||
config_log->p->file_buffer = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1039,12 +1042,15 @@ dump_log (ConfigLog *config_log)
|
|||
first = first->next)
|
||||
write_log (output, first->data);
|
||||
|
||||
config_log->p->first_old = config_log->p->log_data;
|
||||
|
||||
if (config_log->p->file_buffer) {
|
||||
io_buffer_rewind (config_log->p->file_buffer);
|
||||
io_buffer_dump (config_log->p->file_buffer, output);
|
||||
}
|
||||
|
||||
io_buffer_destroy (output);
|
||||
close (out_fd);
|
||||
|
||||
if (config_log->p->filename)
|
||||
rename (filename_out, config_log->p->filename);
|
||||
|
@ -1268,15 +1274,16 @@ socket_data_cb (GIOChannel *channel, GIOCondition condition,
|
|||
|
||||
DEBUG_MSG ("Enter");
|
||||
|
||||
if (condition == G_IO_IN) {
|
||||
load_log_entry (config_log, TRUE,
|
||||
config_log->p->socket_buffer, NULL);
|
||||
}
|
||||
else if (condition == G_IO_HUP) {
|
||||
if (condition & G_IO_HUP) {
|
||||
DEBUG_MSG ("Connection closing");
|
||||
disconnect_socket (config_log);
|
||||
connect_socket (config_log);
|
||||
return FALSE;
|
||||
}
|
||||
else if (condition & G_IO_IN) {
|
||||
load_log_entry (config_log, TRUE,
|
||||
config_log->p->socket_buffer, NULL);
|
||||
}
|
||||
|
||||
DEBUG_MSG ("Exit");
|
||||
|
||||
|
@ -1343,8 +1350,12 @@ slave_data_cb (GIOChannel *channel, GIOCondition condition,
|
|||
}
|
||||
else if (condition & G_IO_IN) {
|
||||
if (load_log_entry (slave->config_log, TRUE, slave->buffer,
|
||||
NULL) != NULL)
|
||||
NULL) != NULL)
|
||||
{
|
||||
slave_broadcast_data (slave, slave->config_log);
|
||||
dump_log (slave->config_log);
|
||||
do_load (slave->config_log);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_MSG ("Exit");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue