graveman-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Graveman-cvs] Changes to graveman/current/src/config.c


From: sylvain cresto
Subject: [Graveman-cvs] Changes to graveman/current/src/config.c
Date: Sat, 26 Feb 2005 22:34:33 -0500

Index: graveman/current/src/config.c
diff -u graveman/current/src/config.c:1.19 graveman/current/src/config.c:1.20
--- graveman/current/src/config.c:1.19  Sat Feb 26 16:15:40 2005
+++ graveman/current/src/config.c       Sun Feb 27 03:34:11 2005
@@ -133,6 +133,17 @@
   fprintf(Lfic, "audiolabel=%s\n", Amediaentry->labelaudio);
 }
 
+/* callback ecriture d'un charset */
+void foreachcharsets(gpointer Acharset, gpointer Adata)
+{
+  FILE *Lfic = (FILE *) Adata;
+  Tdata *Lcharset = (Tdata *) Acharset;
+
+  fprintf(Lfic, "[charsets]\n");
+  fprintf(Lfic, "code=%s\n", Lcharset->data);
+  fprintf(Lfic, "label=%s\n", Lcharset->label);
+}
+
 /* callback ecriture d'un lecteur */
 void foreachdrives(gpointer Adrive, gpointer Adata)
 {
@@ -173,9 +184,11 @@
   g_hash_table_foreach(Gconfigprog, foreachconfig, (gpointer *)(Lfic));
   
   /* ecriture des lecteurs */
-
   g_slist_foreach(Glistdrives, foreachdrives, (gpointer *)(Lfic));
 
+  /* ecriture des charsets */
+  g_slist_foreach(Gcharsetlist, foreachcharsets, (gpointer *)(Lfic));
+
   fclose(Lfic);
 
   return TRUE;
@@ -331,6 +344,19 @@
   return -1;
 }
 
+/* ajout d'un charset a  la liste des charsets */
+gboolean config_append_charset(gchar *Acode, gchar *Alabel)
+{
+  Tdata *Lnewcharset = g_malloc(sizeof(Tdata));
+
+  Lnewcharset->data = g_strdup(Acode);
+  Lnewcharset->label = g_strdup(Alabel && *Alabel ? Alabel : Acode);
+
+  Gcharsetlist = g_slist_append(Gcharsetlist, Lnewcharset);
+
+  return TRUE;
+}
+
 /* ajout d'un media a la liste des media */
 gboolean config_append_media(gulong Alen, gchar *Alabeldata, gchar 
*Alabelaudio)
 {
@@ -419,6 +445,11 @@
     cherchelecteur(NULL, Ag);
   }
 
+  if (Aop & SEARCH_CHARSETS) {
+    /* scan des charsets definie dans mkisofs */
+    cherchecharset(NULL, Ag);
+  }
+
   if (Aop & UPDATE_SIZE && GTK_IS_WIDGET(Lwindow1)) {
     gint Lx = 0, Ly = 0, Lwidth = 0, Lheight = 0;
     /* mise a jour position et taille de la fenetre */
@@ -497,11 +528,11 @@
   gchar *Lkey, *Lvalue;
   gchar **Llignes;
   gchar *Luneligne;
-  gchar Lemplacement[50] = "";
+  gchar Lemplacement[_BUF_SIZE] = "";
   gint i;
   gulong Lmedialen = 0;
-  gchar Lmedialabeldata[50];
-  gchar Lmedialabelaudio[50];
+  gchar Lmedialabeldata[_BUF_SIZE] = "", Lcharsetcode[_BUF_SIZE] = "";
+  gchar Lmedialabelaudio[_BUF_SIZE] = "", Lcharsetlabel[_BUF_SIZE] = "";
   Tdriveinfo *Ldriveinfo = NULL;
 
   if (!g_file_get_contents(Gfileconf, &Lcontents, NULL, Aerror)) {
@@ -537,6 +568,23 @@
       Lkey = Luneligne;
 
       g_hash_table_insert(Gconfigprog, g_strdup(Lkey), g_strdup(Lvalue));
+    } else if (!strcmp(Lemplacement, "[charsets]")) {
+      /* section charsets */
+      Lvalue = strchr(Luneligne, '=');
+      if (Lvalue) { *(Lvalue++)=0; } else { continue; }
+      Lkey = Luneligne;
+
+      if (!strcmp(Lkey, "code")) {
+        g_strlcpy(Lcharsetcode, Lvalue, sizeof(Lcharsetcode)-1);
+      } else if (!strcmp(Lkey, "label")) {
+        g_strlcpy(Lcharsetlabel, Lvalue, sizeof(Lcharsetlabel)-1);
+      }
+
+      if (*Lcharsetcode && *Lcharsetlabel) {
+        config_append_charset(Lcharsetcode, Lcharsetlabel);
+
+        *Lcharsetcode = *Lcharsetlabel = 0;
+      }
     } else if (!strcmp(Lemplacement, "[media]")) {
       /* section liste des medias */
       Lvalue = strchr(Luneligne, '=');




reply via email to

[Prev in Thread] Current Thread [Next in Thread]