summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hestilow <hestilow@ximian.com>2001-07-25 02:58:40 +0000
committerRachel Hestilow <hestgray@src.gnome.org>2001-07-25 02:58:40 +0000
commit17cd2c6e79f62a1f299977e28192646d28365509 (patch)
tree2b4503a71de05be64001ebbf8e5512f3888c17a8
parenta3610b563b47c28a6e13b957ecb54569ea272c72 (diff)
downloadgnome-control-center-17cd2c6e79f62a1f299977e28192646d28365509.tar.gz
Fix date parsing to work with DST.
2001-07-24 Richard Hestilow <hestilow@ximian.com> * config-log.c (parse_line): Fix date parsing to work with DST. * bonobo-config-archiver.[ch]: Export a PropertyBag interface that has the last_modified date as a read-only property.
-rw-r--r--archiver/ChangeLog7
-rw-r--r--archiver/bonobo-config-archiver.c51
-rw-r--r--archiver/bonobo-config-archiver.h2
-rw-r--r--archiver/config-log.c4
4 files changed, 63 insertions, 1 deletions
diff --git a/archiver/ChangeLog b/archiver/ChangeLog
index 1bee372c3..f62e43df1 100644
--- a/archiver/ChangeLog
+++ b/archiver/ChangeLog
@@ -1,3 +1,10 @@
+2001-07-24 Richard Hestilow <hestilow@ximian.com>
+
+ * config-log.c (parse_line): Fix date parsing to work with DST.
+
+ * bonobo-config-archiver.[ch]: Export a PropertyBag interface that
+ has the last_modified date as a read-only property.
+
2001-07-24 Bradford Hovinen <hovinen@ximian.com>
* bonobo-config-archiver.c (real_sync): Notify listeners with a sync event
diff --git a/archiver/bonobo-config-archiver.c b/archiver/bonobo-config-archiver.c
index a01531c7e..94dc60816 100644
--- a/archiver/bonobo-config-archiver.c
+++ b/archiver/bonobo-config-archiver.c
@@ -33,6 +33,8 @@ static GtkObjectClass *parent_class = NULL;
#define PARENT_TYPE BONOBO_CONFIG_DATABASE_TYPE
#define FLUSH_INTERVAL 30 /* 30 seconds */
+extern int daytime;
+
static DirEntry *
dir_lookup_entry (DirData *dir,
char *name,
@@ -463,6 +465,38 @@ real_remove_dir (BonoboConfigDatabase *db,
}
static void
+pb_get_fn (BonoboPropertyBag *bag, BonoboArg *arg,
+ guint arg_id, CORBA_Environment *ev,
+ gpointer user_data)
+{
+ BonoboConfigArchiver *archiver_db = BONOBO_CONFIG_ARCHIVER (user_data);
+ gint id;
+ ConfigLog *log;
+ struct tm *mod;
+ time_t val;
+
+ log = CONFIG_LOG (config_log_open (archiver_db->location));
+ id = config_log_get_rollback_id_by_steps (log, 0, archiver_db->real_name);
+ mod = config_log_get_date_for_id (log, id);
+ val = mktime (mod);
+ g_print ("%i\n", mod->tm_hour);
+ //if (daytime)
+ // val -= 3600;
+
+ BONOBO_ARG_SET_GENERAL (arg, val,
+ TC_ulonglong, CORBA_unsigned_long_long, NULL);
+ gtk_object_destroy (GTK_OBJECT (log));
+}
+
+static void
+pb_set_fn (BonoboPropertyBag *bag, const BonoboArg *arg,
+ guint arg_id, CORBA_Environment *ev,
+ gpointer user_data)
+{
+ g_assert_not_reached ();
+}
+
+static void
bonobo_config_archiver_destroy (GtkObject *object)
{
BonoboConfigArchiver *archiver_db = BONOBO_CONFIG_ARCHIVER (object);
@@ -489,6 +523,9 @@ bonobo_config_archiver_destroy (GtkObject *object)
if (archiver_db->es)
bonobo_object_unref (BONOBO_OBJECT (archiver_db->es));
+ if (archiver_db->pb)
+ bonobo_object_unref (BONOBO_OBJECT (archiver_db->pb));
+
parent_class->destroy (object);
}
@@ -690,6 +727,18 @@ bonobo_config_archiver_new (const char *backend_id, const char *location_id)
bonobo_object_add_interface (BONOBO_OBJECT (archiver_db),
BONOBO_OBJECT (archiver_db->es));
+ archiver_db->pb = bonobo_property_bag_new (pb_get_fn,
+ pb_set_fn,
+ archiver_db);
+
+ bonobo_object_add_interface (BONOBO_OBJECT (archiver_db),
+ BONOBO_OBJECT (archiver_db->pb));
+
+ bonobo_property_bag_add (archiver_db->pb,
+ "last_modified", 1, TC_ulonglong, NULL,
+ "Date (time_t) of modification",
+ BONOBO_PROPERTY_READABLE);
+
db = CORBA_Object_duplicate (BONOBO_OBJREF (archiver_db), NULL);
bonobo_url_register ("BONOBO_CONF:ARCHIVER", real_name, NULL, db, &ev);
@@ -708,6 +757,6 @@ bonobo_config_archiver_new (const char *backend_id, const char *location_id)
gtk_signal_connect (GTK_OBJECT (archiver_db), "destroy",
GTK_SIGNAL_FUNC (unref_cb), ref_obj);
-
+
return db;
}
diff --git a/archiver/bonobo-config-archiver.h b/archiver/bonobo-config-archiver.h
index 6ceddee9c..4e6c6543b 100644
--- a/archiver/bonobo-config-archiver.h
+++ b/archiver/bonobo-config-archiver.h
@@ -16,6 +16,7 @@
#include <gnome-xml/tree.h>
#include <gnome-xml/parser.h>
#include <bonobo/bonobo-event-source.h>
+#include <bonobo/bonobo-property-bag.h>
#include "archive.h"
#include "location.h"
@@ -62,6 +63,7 @@ struct _BonoboConfigArchiver {
gchar *real_name;
BonoboEventSource *es;
+ BonoboPropertyBag *pb;
};
typedef struct {
diff --git a/archiver/config-log.c b/archiver/config-log.c
index c0626ff2f..5f33fcf03 100644
--- a/archiver/config-log.c
+++ b/archiver/config-log.c
@@ -819,6 +819,7 @@ load_log_entry (ConfigLog *config_log, gboolean from_socket,
static gboolean
parse_line (char *buffer, int *id, struct tm *date, char **backend_id)
{
+ extern int daylight;
sscanf (buffer, "%x", id);
while (isxdigit (*buffer)) buffer++;
@@ -853,6 +854,9 @@ parse_line (char *buffer, int *id, struct tm *date, char **backend_id)
*backend_id = buffer;
+ if (daylight)
+ date->tm_hour--;
+
return TRUE;
}