summaryrefslogtreecommitdiff
path: root/src/analysis/db/cdb.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-02-09 22:07:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-02-09 22:07:42 (GMT)
commit1d79469f69bba33a2280d4bd531652b71148029f (patch)
treee81c094d6e829fb1a79d4c413c1cd162e14868a3 /src/analysis/db/cdb.c
parent8d326041a0379b87e54be44506d544367567e89b (diff)
Created a dialog box to create new bookmarks.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@468 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/db/cdb.c')
-rw-r--r--src/analysis/db/cdb.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c
index 24da20e..014a6d8 100644
--- a/src/analysis/db/cdb.c
+++ b/src/analysis/db/cdb.c
@@ -328,7 +328,7 @@ GCdbArchive *g_cdb_archive_new(const char *owner, const rle_string *hash, const
/* Ouverture de l'archive */
- if (!g_cdb_archive_read(result) && 0)
+ if (!g_cdb_archive_read(result))
goto gcan_error;
/* Chargement des éléments sauvegardés */
@@ -712,6 +712,7 @@ static bool g_cdb_archive_create_db(const GCdbArchive *archive, const core_db_in
static bool g_cdb_archive_load_collections(GCdbArchive *archive)
{
GList *iter; /* Boucle de parcours */
+ GDbCollection *collec; /* Collection visée manipulée */
archive->collections = create_collections_list();
@@ -719,7 +720,12 @@ static bool g_cdb_archive_load_collections(GCdbArchive *archive)
iter != NULL;
iter = g_list_next(iter))
{
- g_signal_connect(iter->data, "content-changed", G_CALLBACK(on_collection_changed), archive);
+ collec = G_DB_COLLECTION(iter->data);
+ g_signal_connect(collec, "content-changed", G_CALLBACK(on_collection_changed), archive);
+
+ if (!g_db_collection_load_all_items(collec, archive->db))
+ return false;
+
}
return true;
@@ -762,7 +768,7 @@ static void on_collection_changed(GDbCollection *collec, DBAction action, GDbIte
g_mutex_unlock(&archive->clients_access);
- printf("CHANGED !!\n");
+ printf("CHANGED for %d clients !!\n", (int)archive->count);
@@ -947,6 +953,8 @@ static void *g_cdb_archive_process(GCdbArchive *archive)
DBError g_cdb_archive_add_client(GCdbArchive *archive, int fd, const rle_string *user)
{
+ GList *iter; /* Boucle de parcours */
+ GDbCollection *collec; /* Collection visée manipulée */
volatile pthread_t *process_id; /* Identifiant de la procédure */
@@ -964,6 +972,28 @@ DBError g_cdb_archive_add_client(GCdbArchive *archive, int fd, const rle_string
archive->clients[archive->count - 1].fd = fd;
dup_rle_string(&archive->clients[archive->count - 1].user, user);
+
+
+ /* Envoi des mises à jour au nouveau client... */
+
+
+ for (iter = g_list_first(archive->collections);
+ iter != NULL;
+ iter = g_list_next(iter))
+ {
+ collec = G_DB_COLLECTION(iter->data);
+
+ if (!g_db_collection_send_all_updates(collec, fd))
+ /* TODO */;
+
+
+
+
+
+ }
+
+
+
/* Démarrage ou redémarrage du processus d'écoute */
if (archive->process == NULL)
@@ -979,14 +1009,8 @@ DBError g_cdb_archive_add_client(GCdbArchive *archive, int fd, const rle_string
g_mutex_unlock(&archive->clients_access);
- /* Envoi des mises à jour au nouveau client... */
-
-
- /* TODO */
-
-
- return DBE_NONE;
+ return DBE_NONE; ////
}