[Goodies-commits] r2876 - in xfce4-cddrive-plugin/trunk: panel-plugin po

Sylvain Reynal syl at xfce.org
Thu Jun 28 18:45:23 CEST 2007


Author: syl
Date: 2007-06-28 16:45:23 +0000 (Thu, 28 Jun 2007)
New Revision: 2876

Modified:
   xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.c
   xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.h
   xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor-private.h
   xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c
   xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.h
   xfce4-cddrive-plugin/trunk/panel-plugin/cddrive.c
   xfce4-cddrive-plugin/trunk/po/fr.po
   xfce4-cddrive-plugin/trunk/po/xfce4-cddrive-plugin.pot
Log:
add performers to audio cd labels

Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.c
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.c	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.c	2007-06-28 16:45:23 UTC (rev 2876)
@@ -36,14 +36,59 @@
 #define VERSION "unknown"
 #endif
 
-#define CDDRIVE_CDDB_CACHE_PATH           "xfce4/panel/cddrive"
-#define CDDRIVE_CDDB_CACHE_GROUP          "Cddb"
-#define CDDRIVE_CDDB_CACHE_SIZE           20
+#define CDDRIVE_CDDB_CACHE_PATH             "xfce4/panel/cddrive"
+#define CDDRIVE_CDDB_CACHE_INFOS_GROUP_ID   "infos"
+#define CDDRIVE_CDDB_CACHE_VERSION_ID       "version"
+#define CDDRIVE_CDDB_CACHE_VERSION          "1"
+#define CDDRIVE_CDDB_CACHE_SIZE             20
+#define CDDRIVE_CDDB_CACHE_PERFORMERS_ID    "perf"
+#define CDDRIVE_CDDB_CACHE_TITLE_ID         "title"
+
 #define cddrive_audio_get_key_for_id(id)  g_strdup_printf ("%08x", id)
 
 #endif
 
 
+
+/* Return a structure containing the infos passed as parameters.
+   Return NULL if there is not enough memory, or if all the parameters are NULL.
+   The string parameters should not be freed, this is done by calling
+   'cddrive_audio_free_infos'.*/
+static CddriveAudioInfos*
+cddrive_audio_new_infos (gchar *performers, gchar *title)
+{
+  CddriveAudioInfos *res;
+
+  if (performers == NULL && title == NULL)
+    return NULL;
+
+  res = g_try_malloc (sizeof (CddriveAudioInfos));
+  if (res == NULL)
+    {
+      g_warning ("not enough memory to store the audio CD infos.");
+      return NULL;
+    }
+  
+  res->performers = performers;
+  res->title = title;
+
+  return res;
+}
+
+
+
+void
+cddrive_audio_free_infos (CddriveAudioInfos *infos)
+{
+  g_assert (infos != NULL);
+
+  g_free (infos->performers);
+  g_free (infos->title);
+  g_free (infos);
+}
+
+
+
 /* Create a read access on the CD */
 static CdIo_t*
 cddrive_audio_new_cdio (const gchar* device)
@@ -69,16 +114,17 @@
 
 
 
-/* Return the title of the CD from the CD-TEXT info it contains,
-   or NULL if the CD does not contain such CD-TEXT info. */
-static gchar*
-cddrive_audio_get_cdtext_title (CdIo_t *cdio)
+/* Return the infos of the CD from CD-TEXT, or NULL if the CD does not contain
+   such information. */
+static CddriveAudioInfos*
+cddrive_audio_get_cdtext_infos (CdIo_t *cdio)
 {
-  gchar    *res;
-  cdtext_t *cdtxt;
+  CddriveAudioInfos *res;
+  cdtext_t          *cdtxt;
 
   cdtxt = cdio_get_cdtext (cdio, 0);
-  res = cdtext_get (CDTEXT_TITLE, cdtxt);
+  res = cddrive_audio_new_infos (cdtext_get (CDTEXT_PERFORMER, cdtxt),
+                                 cdtext_get (CDTEXT_TITLE, cdtxt));
   cdtext_destroy (cdtxt);
 
   return res;
@@ -88,6 +134,89 @@
 
 #ifdef HAVE_LIBCDDB /* ---------- CDDB SUPPORT ---------- */
 
+/* Open cache without checking version */
+static XfceRc*
+cddrive_audio_open_cache (gboolean readonly)
+{
+  XfceRc *res;
+
+  res = xfce_rc_config_open (XFCE_RESOURCE_CACHE,
+                             CDDRIVE_CDDB_CACHE_PATH,
+                             readonly);
+  if (res == NULL)
+    g_warning ("unable to open CDDB cache file for %s.",
+                 (readonly ? "reading" : "writing"));
+  
+  return res;
+}
+
+
+
+/* Clear cache and set version to 'CDDRIVE_CDDB_CACHE_VERSION' */
+static void
+cddrive_audio_reset_cddb_cache (XfceRc *cache)
+{
+  gchar* *l;
+  gint    i;
+
+  l = xfce_rc_get_groups (cache);
+  for (i = 0; l [i] != NULL; i++)
+    xfce_rc_delete_group (cache, l [i], FALSE);
+  
+  g_strfreev (l);
+  
+  xfce_rc_set_group (cache, CDDRIVE_CDDB_CACHE_INFOS_GROUP_ID);
+  xfce_rc_write_entry (cache,
+                       CDDRIVE_CDDB_CACHE_VERSION_ID,
+                       CDDRIVE_CDDB_CACHE_VERSION);
+}
+
+
+
+/* Open cache, check it, and reset it if necessary */
+static XfceRc*
+cddrive_audio_get_cddb_cache (gboolean readonly)
+{
+  XfceRc      *res;
+  const gchar *v;
+
+  res = cddrive_audio_open_cache (readonly);
+  if (res == NULL)
+    return NULL;
+  
+  xfce_rc_set_group (res, CDDRIVE_CDDB_CACHE_INFOS_GROUP_ID);
+  v = xfce_rc_read_entry (res, CDDRIVE_CDDB_CACHE_VERSION_ID, "not set");
+  
+  if (! g_str_equal (CDDRIVE_CDDB_CACHE_VERSION, v))
+    {
+      g_message ("current CDDB cache version is %s. Reseting cache to version %s",
+                 v, CDDRIVE_CDDB_CACHE_VERSION);
+      
+      if (readonly)
+        {
+          /* reopen cache for writing */
+          xfce_rc_close (res);
+          res = cddrive_audio_open_cache (FALSE);
+          if (res == NULL)
+            return NULL;
+          
+          cddrive_audio_reset_cddb_cache (res);
+          
+          /* reopen cache for reading */
+          xfce_rc_close (res);
+          res = cddrive_audio_open_cache (TRUE);
+          if (res == NULL)
+            return NULL;
+        }
+      else
+        cddrive_audio_reset_cddb_cache (res);      
+    }
+  
+  return res;
+}
+
+
+
 /* Save a pair (CDDB id, CD title) in the cache file only if it is not already
    stored. Do nothing otherwise.
    
@@ -95,41 +224,49 @@
    
    The cache file is a Xfce rc file, containing a group called "Cddb" with
    at most CDDRIVE_CDDB_CACHE_SIZE entries, each having a CDDB id as the key,
-   and a CD title as the value.
+   and a list (title, performers) as the value.
 */
 static void
-cddrive_audio_cache_save (guint id, const gchar *title)
+cddrive_audio_cache_save (guint id, CddriveAudioInfos *infos)
 {
-  XfceRc *cache;
+  XfceRc *cache = NULL;
   gchar* *keys;
-  gchar  *k;
-  guint   nb;
+  gchar  *k, *k2;
+  guint   n;
 
-  cache = xfce_rc_config_open (XFCE_RESOURCE_CACHE,
-                               CDDRIVE_CDDB_CACHE_PATH,
-                               FALSE);
+  g_assert (infos != NULL);
+
+  cache = cddrive_audio_get_cddb_cache (FALSE);
   if (cache == NULL)
-    {
-      g_warning ("unable to open CDDB cache file.");
-      return;
-    }
+    return;
   
-  xfce_rc_set_group (cache, CDDRIVE_CDDB_CACHE_GROUP);
-  
   k = cddrive_audio_get_key_for_id (id);
-  if (! xfce_rc_has_entry (cache, k))
+  if (! xfce_rc_has_group (cache, k))
     {
-      /* check if the cache limit is reached. If so, remove the first entry. */
-      keys = xfce_rc_get_entries (cache, CDDRIVE_CDDB_CACHE_GROUP);
-      nb = g_strv_length (keys);
-    
-      if (nb >= CDDRIVE_CDDB_CACHE_SIZE)
-        xfce_rc_delete_entry (cache, keys [0], FALSE);
+      /* check if the cache size is over the limit. If so, remove the first groups
+         until the limit is reached. */
+      keys = xfce_rc_get_groups (cache);
+      for (n = g_strv_length (keys); n > CDDRIVE_CDDB_CACHE_SIZE; n--)
+        {
+          k2 = keys [n - CDDRIVE_CDDB_CACHE_SIZE];
+        
+          /* do not delete the cache internal infos group */
+          if (! g_str_equal (k2, CDDRIVE_CDDB_CACHE_INFOS_GROUP_ID))
+            xfce_rc_delete_entry (cache, k2, FALSE);
+        }
       
       g_strfreev (keys);
       
-      /* write the new entry */
-      xfce_rc_write_entry (cache, k, title);
+      /* write the new group */
+      xfce_rc_set_group (cache, k);
+      if (infos->performers != NULL)
+        xfce_rc_write_entry (cache,
+                             CDDRIVE_CDDB_CACHE_PERFORMERS_ID,
+                             infos->performers);
+      if (infos->performers != NULL)
+        xfce_rc_write_entry (cache,
+                             CDDRIVE_CDDB_CACHE_TITLE_ID,
+                             infos->title);
     }
   
   xfce_rc_close (cache);
@@ -138,26 +275,33 @@
 
 
 
-/* Return the title corresponding to the CDDB id 'id' in the cache, or NULL
-   if not found. */
-gchar*
+/* Return the infos corresponding to the CDDB id 'id' in the cache, or NULL
+   if not found.
+   If not NULL, free the result with 'cddrive_audio_free_infos'. */
+static CddriveAudioInfos*
 cddrive_audio_cache_read (guint id)
 {
-  XfceRc *cache;
-  gchar  *k, *res;
+  CddriveAudioInfos *res = NULL;
+  XfceRc            *cache;
+  gchar             *k;
 
-  cache = xfce_rc_config_open (XFCE_RESOURCE_CACHE,
-                               CDDRIVE_CDDB_CACHE_PATH,
-                               TRUE);
+  cache = cddrive_audio_get_cddb_cache (TRUE);
   if (cache == NULL)
+    return NULL;
+  
+  k = cddrive_audio_get_key_for_id (id);
+  
+  if (xfce_rc_has_group (cache, k))
     {
-      g_warning ("unable to open CDDB cache file.");
-      return NULL;
+      xfce_rc_set_group (cache, k);
+      res = cddrive_audio_new_infos (g_strdup (xfce_rc_read_entry (cache,
+                                                  CDDRIVE_CDDB_CACHE_PERFORMERS_ID,
+                                                  NULL)),
+                                     g_strdup (xfce_rc_read_entry (cache,
+                                                  CDDRIVE_CDDB_CACHE_TITLE_ID,
+                                                  NULL)));
     }
   
-  xfce_rc_set_group (cache, CDDRIVE_CDDB_CACHE_GROUP);
-  k = cddrive_audio_get_key_for_id (id);
-  res = g_strdup (xfce_rc_read_entry (cache, k, NULL));
   xfce_rc_close (cache);
   g_free (k);
   
@@ -283,10 +427,11 @@
 
 
 static gpointer
-cddrive_audio_cache_title_from_server (gpointer data)
+cddrive_audio_cache_infos_from_server (gpointer data)
 {
-  cddb_disc_t *cdda = (cddb_disc_t*) data;
-  cddb_conn_t *conn;
+  cddb_disc_t       *cdda = (cddb_disc_t*) data;
+  cddb_conn_t       *conn;
+  CddriveAudioInfos *infos;
   static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
 
   /* we don't want two connections at the same time, have mercy for freedb.org,
@@ -296,18 +441,25 @@
       conn = cddrive_audio_new_connection ();
       if (conn != NULL)
         {
+          g_debug ("sending query to freedb.org");
           if (cddb_query (conn, cdda) == -1)
             g_warning ("query on server '%s' failed (%s).",
                        cddb_get_server_name (conn),
                        cddb_error_str (cddb_errno (conn)));
           else
             {
-              if (cddb_disc_get_title (cdda) != NULL)
-                cddrive_audio_cache_save (cddb_disc_get_discid (cdda),
-                                          cddb_disc_get_title (cdda));
+              infos = cddrive_audio_new_infos (g_strdup (cddb_disc_get_artist (cdda)),
+                                               g_strdup (cddb_disc_get_title (cdda)));
+                                               
+              if (infos != NULL)
+                {
+                  cddrive_audio_cache_save (cddb_disc_get_discid (cdda), infos);
+                  cddrive_audio_free_infos (infos);
+                }
             }
       
           cddb_destroy (conn);
+          g_debug ("freedb.org connection closed");
         }
       g_static_mutex_unlock (&mutex);
     }
@@ -319,12 +471,12 @@
 
 
 
-gchar*
-cddrive_audio_get_title (const gchar* device, gboolean connection_allowed)
+CddriveAudioInfos*
+cddrive_audio_get_infos (const gchar* device, gboolean connection_allowed)
 {
-  gchar       *res = NULL;
-  cddb_disc_t *cdda;
-  CdIo_t      *cdio;
+  CddriveAudioInfos *res = NULL;
+  cddb_disc_t       *cdda;
+  CdIo_t            *cdio;
 
   g_assert (device != NULL);
 
@@ -338,27 +490,36 @@
       
           if (res == NULL)
             {
-              res = cddrive_audio_get_cdtext_title (cdio);
+              res = cddrive_audio_get_cdtext_infos (cdio);
         
-              if (res == NULL && connection_allowed)
+              if (res == NULL)
                 {
-                  /* the CDDB disc id was not found in cache. Try to fetch it on freedb.org */
+                  if (connection_allowed)
+                    {
+                      /* the CDDB disc id was not found in cache. Try to fetch it on freedb.org */
         
 #ifdef HAVE_GTHREAD
-                  /* if possible, fetch the title in a thread, so the plugin do not freeze
-                     while attempting to connect to the server */          
-                  g_thread_create (cddrive_audio_cache_title_from_server,
-                                   cdda,
-                                   FALSE,
-                                   NULL);
-                  /* note: cdda is destroyed in the thread function */
+                      /* if possible, fetch the infos in a thread, so the plugin do not freeze
+                         while attempting to connect to the server */          
+                      g_thread_create (cddrive_audio_cache_infos_from_server,
+                                       cdda,
+                                       FALSE,
+                                       NULL);
+                      /* note: cdda is destroyed in the thread function */
         
 #else
-                  /* no thread support, plugin freeze will depend on the connection quality */
-                  cddrive_audio_cache_title_from_server (cdda);
-                  res = g_strdup (cddb_disc_get_title (cdda));
+                      /* no thread support, plugin freeze will depend on the connection quality */
+                      /* note: cdda is destroyed in this function */
+                      cddrive_audio_cache_infos_from_server (cdda);
+                      res = g_strdup (cddb_disc_get_title (cdda));
 #endif
+                    }
                 }
+              else
+                {
+                  cddrive_audio_cache_save (cddb_disc_get_discid (cdda), res);
+                  cddb_disc_destroy (cdda);
+                }
             }
         }
       
@@ -391,18 +552,18 @@
 
 #else /* ---------- NO CDDB SUPPORT ---------- */
 
-gchar*
-cddrive_audio_get_title (const gchar* device, gboolean connection_allowed)
+CddriveAudioInfos*
+cddrive_audio_get_infos (const gchar* device, gboolean connection_allowed)
 {
-  gchar       *res = NULL;
-  CdIo_t      *cdio;
+  CddriveAudioInfos *res = NULL;
+  CdIo_t            *cdio;
 
   g_assert (device != NULL);
 
   cdio = cddrive_audio_new_cdio (device);
   if (cdio != NULL)
     {
-      res = cddrive_audio_get_cdtext_title (cdio);
+      res = cddrive_audio_get_cdtext_infos (cdio);
       cdio_destroy (cdio);
     }
   

Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.h
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.h	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-audio.h	2007-06-28 16:45:23 UTC (rev 2876)
@@ -25,9 +25,16 @@
 
 G_BEGIN_DECLS
 
-/* freedb.org support (to get the title of an audio CD) */
+/* Access to the informations of an audio CD */
 
+typedef struct
+{
+  gchar *performers;
+  gchar *title;
+} CddriveAudioInfos;
 
+
+
 /* To call at program start */
 void
 cddrive_audio_init_globals ();
@@ -41,19 +48,24 @@
 
 
 
-/* Return the title of the audio CD in the drive of device path 'device',
+/* Return informations of the audio CD in the drive of device path 'device',
    or NULL if the drive have no audio CD, or if the operation failed.
    
-   If compiled without CDDB support, the function looks for the title using
+   If compiled without CDDB support, the function looks for the infos using
    CD-TEXT only.
    If compiled with CDDB support and 'connection_allowed' is FALSE, the function
-   looks for the title using the cache and CD-TEXT only.
+   looks for the infos using the cache and CD-TEXT only.
    Otherwise, the function connects to one of the freedb.org server if cache
    or CD-TEXT methods failed.
    
    The result must be freed after use. */
-gchar*
-cddrive_audio_get_title (const gchar* device, gboolean connection_allowed);
+CddriveAudioInfos*
+cddrive_audio_get_infos (const gchar* device, gboolean connection_allowed);
 
+
+
+void
+cddrive_audio_free_infos (CddriveAudioInfos *infos);
+
 G_END_DECLS
 #endif

Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor-private.h
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor-private.h	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor-private.h	2007-06-28 16:45:23 UTC (rev 2876)
@@ -52,8 +52,8 @@
      we don't really expect this property to change, do we ?) */
   gboolean       is_ejectable;
 
-  /* disc title cache */
-  gchar         *cd_title;
+  /* disc label cache */
+  gchar         *cd_label;
   
   gboolean       use_cddb; /* are freedb.org connections allowed ? */
 } _CddriveMonitor;

Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c	2007-06-28 16:45:23 UTC (rev 2876)
@@ -427,8 +427,8 @@
   g_free (monitor->udi);
   monitor->udi = NULL;
   
-  g_free (monitor->cd_title);
-  monitor->cd_title = NULL;
+  g_free (monitor->cd_label);
+  monitor->cd_label = NULL;
 }
 
 
@@ -602,7 +602,7 @@
   res->on_disc_modified     = on_disc_modified_callback;
   res->udi                  = NULL;
   res->is_ejectable         = FALSE;
-  res->cd_title             = NULL;
+  res->cd_label             = NULL;
   res->use_cddb             = use_cddb;
 
   res->mount                = NULL;
@@ -687,7 +687,7 @@
 
   g_free (monitor->mount);
   g_free (monitor->unmount);
-  g_free (monitor->cd_title);
+  g_free (monitor->cd_label);
   g_free (monitor);
 }
 
@@ -1020,6 +1020,33 @@
 
 
 
+static void
+cddrive_monitor_store_audio_disc_label (CddriveMonitor *monitor)
+{
+  CddriveAudioInfos *nfo;
+
+  g_assert (monitor != NULL);
+  g_assert (monitor->dev != NULL);
+  g_assert (monitor->cd_label == NULL);
+
+  nfo = cddrive_audio_get_infos (monitor->dev, monitor->use_cddb);
+  if (nfo != NULL)
+    {
+      g_assert (nfo->performers != NULL || nfo->title != NULL);
+    
+      if (nfo->performers == NULL)
+        monitor->cd_label = g_strdup (nfo->title);
+      else
+        monitor->cd_label = g_strconcat (nfo->performers,
+                                         " - ",
+                                         (nfo->title == NULL) ? _("unknown title") : nfo->title,
+                                         NULL);
+      cddrive_audio_free_infos (nfo);
+    }
+}
+
+
+
 static const gchar*
 cddrive_status_get_disc_icon_name (LibHalVolume *disc)
 {
@@ -1108,17 +1135,17 @@
         
       res->type  = cddrive_disc_type_name [libhal_volume_get_disc_type (vol) - LIBHAL_VOLUME_DISC_TYPE_CDROM];
     
-      if (monitor->cd_title == NULL)
+      if (monitor->cd_label == NULL)
         {
           /* cache cd title */
           if (res->is_audio)
-            /* launch CDDB query if enabled and threaded, and set cd_title to NULL
-               if the connection is not fast enough. The title will then be stored upon
-               a call of 'cddrive_status_get_title'.
-               Otherwise (CDDB disabled or not threaded) wait and store the title (if any). */
-            monitor->cd_title = cddrive_audio_get_title (monitor->dev, monitor->use_cddb);
+            /* launch CDDB query if enabled and threaded, and let cd_label set to NULL
+               if the connection is not fast enough. The label will then be stored upon
+               a call of 'cddrive_status_get_label'.
+               Otherwise (CDDB disabled or not threaded) wait and store the label (if any). */
+            cddrive_monitor_store_audio_disc_label (monitor);
           else
-            monitor->cd_title = g_strdup (libhal_volume_get_label (vol));
+            monitor->cd_label = g_strdup (libhal_volume_get_label (vol));
         }
       
       libhal_volume_free (vol);
@@ -1202,17 +1229,17 @@
 
 
 const gchar*
-cddrive_status_get_title (CddriveStatus *status)
+cddrive_status_get_label (CddriveStatus *status)
 {
   CddriveMonitor *m;
 
   g_assert (status != NULL);
 
   m = status->mon;
-  if (status->is_audio && m->cd_title == NULL)
-    m->cd_title = cddrive_audio_get_title (m->dev, m->use_cddb);
+  if (status->is_audio && m->cd_label == NULL)
+    cddrive_monitor_store_audio_disc_label (m);
   
-  return m->cd_title;  
+  return m->cd_label;  
 }
 
 

Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.h
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.h	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.h	2007-06-28 16:45:23 UTC (rev 2876)
@@ -173,10 +173,11 @@
 
 
 
-/* Title of the disc. NULL if there is none or the disc is audio or blank.
+/* Label of the disc. NULL if there is none or the disc is blank, or audio
+   (if the cd infos are not available).
    'status' must not be NULL. */
 const gchar*
-cddrive_status_get_title     (CddriveStatus *status);
+cddrive_status_get_label     (CddriveStatus *status);
 
 
 

Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive.c
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive.c	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive.c	2007-06-28 16:45:23 UTC (rev 2876)
@@ -176,7 +176,7 @@
 static gchar*
 cddrive_get_unnamed_tip_text_from_status (CddriveStatus *status)
 {
-  const gchar *title, *type;
+  const gchar *label, *type;
 
   /* Even if it result in a clumsy code, try to write the messages without using
      concatenation tricks, to preserve their meaning in the po files. */
@@ -203,7 +203,7 @@
   /* There is a disc in the drive : use title whenever it is available.
      Otherwise, use disc type. */
   
-  title = cddrive_status_get_title (status);
+  label = cddrive_status_get_label (status);
   type  = cddrive_status_get_type (status);
   
   if (cddrive_status_is_ejectable (status))
@@ -212,9 +212,9 @@
         /* translation note: "Eject blank <disc type>" (e.g. "Eject blank cd-rw") */
         return g_strdup_printf (_("Eject blank %s"), type);
       
-      if (title != NULL)
-        /* translation note: "Eject \"<disc title>\"" */
-        return g_strdup_printf (_("Eject \"%s\""), title);
+      if (label != NULL)
+        /* translation note: "Eject \"<disc label>\"" */
+        return g_strdup_printf (_("Eject \"%s\""), label);
 
       if (cddrive_status_is_audio (status))
         /* translation note: "Eject audio <disc type>" */
@@ -230,10 +230,10 @@
     /* translation note: "Blank <disc type>" (e.g. "Blank cd-rw") */
     return g_strdup_printf (_("Blank %s"), type);
       
-  if (title != NULL)
-    /* translation note: "\"<disc title>\" (made translatable in case translation
+  if (label != NULL)
+    /* translation note: "\"<disc label>\" (made translatable in case translation
                          do not use the '"' character to enclose the title) */
-    return g_strdup_printf (_("\"%s\""), title);
+    return g_strdup_printf (_("\"%s\""), label);
 
   if (cddrive_status_is_audio (status))
     /* translation note: "Audio <disc type>" */
@@ -249,7 +249,7 @@
 cddrive_get_named_tip_text_from_status (CddriveStatus *status,
                                         const gchar   *drive_name)
 {
-  const gchar *title, *type;
+  const gchar *label, *type;
   
   g_assert (drive_name != NULL);
 
@@ -283,7 +283,7 @@
   /* There is a disc in the drive : use title whenever it is available.
      Otherwise, use disc type. */
   
-  title = cddrive_status_get_title (status);
+  label = cddrive_status_get_label (status);
   type  = cddrive_status_get_type (status);
   
   if (cddrive_status_is_ejectable (status))
@@ -292,9 +292,9 @@
         /* translation note: "Eject blank <disc type> from <drive name>" (e.g. "Eject blank cd-rw from cdrom1") */
         return g_strdup_printf (_("Eject blank %s from %s"), type, drive_name);
       
-      if (title != NULL)
-        /* translation note: "Eject \"<disc title>\" from <drive name>" */
-        return g_strdup_printf (_("Eject \"%s\" from %s"), title, drive_name);
+      if (label != NULL)
+        /* translation note: "Eject \"<disc label>\" from <drive name>" */
+        return g_strdup_printf (_("Eject \"%s\" from %s"), label, drive_name);
 
       if (cddrive_status_is_audio (status))
         /* translation note: "Eject audio <disc type> from <drive name>" */
@@ -310,9 +310,9 @@
     /* translation note: "Blank <disc type> in <drive name>" (e.g. "Blank cd-rw in cdrom1") */
     return g_strdup_printf (_("Blank %s in %s"), type, drive_name);
       
-  if (title != NULL)
-    /* translation note: "\"<disc title>\" in <drive name>" (e.g. ""Backup #36" in cdrom1") */
-    return g_strdup_printf (_("\"%s\" in %s"), title, drive_name);
+  if (label != NULL)
+    /* translation note: "\"<disc label>\" in <drive name>" (e.g. ""Backup #36" in cdrom1") */
+    return g_strdup_printf (_("\"%s\" in %s"), label, drive_name);
 
   if (cddrive_status_is_audio (status))
     /* translation note: "Audio <disc type> in <drive name>" */
@@ -417,7 +417,7 @@
   else
     {
       label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (cddrive->menu_item)));
-      title = cddrive_status_get_title (status);
+      title = cddrive_status_get_label (status);
       if (title == NULL)
         {
           if (cddrive_status_is_mounted (status))

Modified: xfce4-cddrive-plugin/trunk/po/fr.po
===================================================================
--- xfce4-cddrive-plugin/trunk/po/fr.po	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/po/fr.po	2007-06-28 16:45:23 UTC (rev 2876)
@@ -6,10 +6,10 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: 0.0.1\n"
+"Project-Id-Version: 0.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-06-27 10:23+0200\n"
-"PO-Revision-Date: 2007-05-22 14:50+0200\n"
+"POT-Creation-Date: 2007-06-28 18:51+0200\n"
+"PO-Revision-Date: 2007-06-27 23:05+0200\n"
 "Last-Translator: Sylvain Reynal <sreynal at nerim.net>\n"
 "Language-Team: \n"
 "MIME-Version: 1.0\n"
@@ -40,7 +40,7 @@
 msgid "Eject blank %s"
 msgstr "Éjecter le %s vierge"
 
-#. translation note: "Eject \"<disc title>\""
+#. translation note: "Eject \"<disc label>\""
 #: ../panel-plugin/cddrive.c:217
 #, c-format
 msgid "Eject \"%s\""
@@ -64,7 +64,7 @@
 msgid "Blank %s"
 msgstr "%s vierge"
 
-#. translation note: "\"<disc title>\" (made translatable in case translation
+#. translation note: "\"<disc label>\" (made translatable in case translation
 #. do not use the '"' character to enclose the title)
 #: ../panel-plugin/cddrive.c:236
 #, c-format
@@ -108,7 +108,7 @@
 msgid "Eject blank %s from %s"
 msgstr "Éjecter le %s vierge de %s"
 
-#. translation note: "Eject \"<disc title>\" from <drive name>"
+#. translation note: "Eject \"<disc label>\" from <drive name>"
 #: ../panel-plugin/cddrive.c:297
 #, c-format
 msgid "Eject \"%s\" from %s"
@@ -132,7 +132,7 @@
 msgid "Blank %s in %s"
 msgstr "%s vierge dans %s"
 
-#. translation note: "\"<disc title>\" in <drive name>" (e.g. ""Backup #36" in cdrom1")
+#. translation note: "\"<disc label>\" in <drive name>" (e.g. ""Backup #36" in cdrom1")
 #: ../panel-plugin/cddrive.c:315
 #, c-format
 msgid "\"%s\" in %s"
@@ -246,57 +246,62 @@
 msgstr "Couleur de l'icône du disque démonté"
 
 #. --- "Drive" section  ---
-#: ../panel-plugin/cddrive-dialogs.c:482
+#: ../panel-plugin/cddrive-dialogs.c:479
 msgid "Drive"
 msgstr "Lecteur"
 
-#: ../panel-plugin/cddrive-dialogs.c:490
+#: ../panel-plugin/cddrive-dialogs.c:487
 msgid "CD-ROM drive detection failed !"
 msgstr "La détection du lecteur CD-ROM a échoué !"
 
-#: ../panel-plugin/cddrive-dialogs.c:497
+#: ../panel-plugin/cddrive-dialogs.c:494
 msgid "No CD-ROM drive detected"
 msgstr "Aucun lecteur de CD-ROM détecté"
 
 #. if some drives have been detected...
 #. --- "Commands" section ---
-#: ../panel-plugin/cddrive-dialogs.c:547
+#: ../panel-plugin/cddrive-dialogs.c:544
 msgid "Fallback Commands"
 msgstr "Commandes de rechange"
 
 #. --- "Display" section ---
 #. -- name config --
-#: ../panel-plugin/cddrive-dialogs.c:558
+#: ../panel-plugin/cddrive-dialogs.c:555
 msgid "Display"
 msgstr "Affichage"
 
-#: ../panel-plugin/cddrive-dialogs.c:563
+#: ../panel-plugin/cddrive-dialogs.c:560
 msgid "Name to display"
 msgstr "Nom à afficher"
 
-#: ../panel-plugin/cddrive-dialogs.c:587
+#: ../panel-plugin/cddrive-dialogs.c:575
+msgid "Write here the name of the drive to display in panel or tooltip."
+msgstr ""
+"Écrivez ici le nom du lecteur à afficher dans le panneau ou la bulle d'aide."
+
+#: ../panel-plugin/cddrive-dialogs.c:588
 msgid "display in panel"
 msgstr "afficher dans le panneau"
 
-#: ../panel-plugin/cddrive-dialogs.c:598
+#: ../panel-plugin/cddrive-dialogs.c:599
 msgid "use in tooltip"
 msgstr "utiliser dans la bulle d'aide"
 
-#: ../panel-plugin/cddrive-dialogs.c:620
+#: ../panel-plugin/cddrive-dialogs.c:621
 msgid "Unmounted disc icon opacity"
 msgstr "Opacité de l'icône du disque démonté"
 
 #. --- Network section ---
-#: ../panel-plugin/cddrive-dialogs.c:645
+#: ../panel-plugin/cddrive-dialogs.c:646
 msgid "Network"
 msgstr "Réseau"
 
 #. -- CDDB config --
-#: ../panel-plugin/cddrive-dialogs.c:648
+#: ../panel-plugin/cddrive-dialogs.c:649
 msgid "Allow freedb.org connections"
 msgstr "Autoriser les connections à freedb.org"
 
-#: ../panel-plugin/cddrive-dialogs.c:653
+#: ../panel-plugin/cddrive-dialogs.c:654
 msgid ""
 "Enabling this option allows the plugin to query the freedb.org servers in "
 "order to get the title of an audio CD."
@@ -304,12 +309,12 @@
 "Activer cette option permet au plugin d'interroger les serveurs freedb.org "
 "de manière à récupérer le titre d'un CD audio."
 
-#: ../panel-plugin/cddrive-dialogs.c:681
+#: ../panel-plugin/cddrive-dialogs.c:682
 #: ../panel-plugin/cddrive.desktop.in.in.h:2
 msgid "CD-ROM drive tray and content control"
 msgstr "Contrôle du plateau et du contenu d'un lecteur CD."
 
-#: ../panel-plugin/cddrive-dialogs.c:724
+#: ../panel-plugin/cddrive-dialogs.c:725
 msgid "No error description available."
 msgstr "Pas de description d'erreur disponible."
 
@@ -419,11 +424,6 @@
 msgid "Failed to store monitor in HAL context."
 msgstr "Le stockage du moniteur dans le contexte HAL a échoué."
 
-#~ msgid "Error"
-#~ msgstr "Erreur"
-
-#~ msgid "Failed to unregister drive addition callback."
-#~ msgstr "Échec du désenregistrement du callback d'ajout du lecteur."
-
-#~ msgid "Failed to unregister drive removal callback."
-#~ msgstr "Échec du désenregistrement du callback d'enlèvement du lecteur."
+#: ../panel-plugin/cddrive-monitor.c:1042
+msgid "unknown title"
+msgstr "titre inconnu"

Modified: xfce4-cddrive-plugin/trunk/po/xfce4-cddrive-plugin.pot
===================================================================
--- xfce4-cddrive-plugin/trunk/po/xfce4-cddrive-plugin.pot	2007-06-28 16:29:55 UTC (rev 2875)
+++ xfce4-cddrive-plugin/trunk/po/xfce4-cddrive-plugin.pot	2007-06-28 16:45:23 UTC (rev 2876)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-06-27 10:23+0200\n"
+"POT-Creation-Date: 2007-06-28 18:51+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -39,7 +39,7 @@
 msgid "Eject blank %s"
 msgstr ""
 
-#. translation note: "Eject \"<disc title>\""
+#. translation note: "Eject \"<disc label>\""
 #: ../panel-plugin/cddrive.c:217
 #, c-format
 msgid "Eject \"%s\""
@@ -63,7 +63,7 @@
 msgid "Blank %s"
 msgstr ""
 
-#. translation note: "\"<disc title>\" (made translatable in case translation
+#. translation note: "\"<disc label>\" (made translatable in case translation
 #. do not use the '"' character to enclose the title)
 #: ../panel-plugin/cddrive.c:236
 #, c-format
@@ -106,7 +106,7 @@
 msgid "Eject blank %s from %s"
 msgstr ""
 
-#. translation note: "Eject \"<disc title>\" from <drive name>"
+#. translation note: "Eject \"<disc label>\" from <drive name>"
 #: ../panel-plugin/cddrive.c:297
 #, c-format
 msgid "Eject \"%s\" from %s"
@@ -130,7 +130,7 @@
 msgid "Blank %s in %s"
 msgstr ""
 
-#. translation note: "\"<disc title>\" in <drive name>" (e.g. ""Backup #36" in cdrom1")
+#. translation note: "\"<disc label>\" in <drive name>" (e.g. ""Backup #36" in cdrom1")
 #: ../panel-plugin/cddrive.c:315
 #, c-format
 msgid "\"%s\" in %s"
@@ -236,68 +236,72 @@
 msgstr ""
 
 #. --- "Drive" section  ---
-#: ../panel-plugin/cddrive-dialogs.c:482
+#: ../panel-plugin/cddrive-dialogs.c:479
 msgid "Drive"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:490
+#: ../panel-plugin/cddrive-dialogs.c:487
 msgid "CD-ROM drive detection failed !"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:497
+#: ../panel-plugin/cddrive-dialogs.c:494
 msgid "No CD-ROM drive detected"
 msgstr ""
 
 #. if some drives have been detected...
 #. --- "Commands" section ---
-#: ../panel-plugin/cddrive-dialogs.c:547
+#: ../panel-plugin/cddrive-dialogs.c:544
 msgid "Fallback Commands"
 msgstr ""
 
 #. --- "Display" section ---
 #. -- name config --
-#: ../panel-plugin/cddrive-dialogs.c:558
+#: ../panel-plugin/cddrive-dialogs.c:555
 msgid "Display"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:563
+#: ../panel-plugin/cddrive-dialogs.c:560
 msgid "Name to display"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:587
+#: ../panel-plugin/cddrive-dialogs.c:575
+msgid "Write here the name of the drive to display in panel or tooltip."
+msgstr ""
+
+#: ../panel-plugin/cddrive-dialogs.c:588
 msgid "display in panel"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:598
+#: ../panel-plugin/cddrive-dialogs.c:599
 msgid "use in tooltip"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:620
+#: ../panel-plugin/cddrive-dialogs.c:621
 msgid "Unmounted disc icon opacity"
 msgstr ""
 
 #. --- Network section ---
-#: ../panel-plugin/cddrive-dialogs.c:645
+#: ../panel-plugin/cddrive-dialogs.c:646
 msgid "Network"
 msgstr ""
 
 #. -- CDDB config --
-#: ../panel-plugin/cddrive-dialogs.c:648
+#: ../panel-plugin/cddrive-dialogs.c:649
 msgid "Allow freedb.org connections"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:653
+#: ../panel-plugin/cddrive-dialogs.c:654
 msgid ""
 "Enabling this option allows the plugin to query the freedb.org servers in "
 "order to get the title of an audio CD."
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:681
+#: ../panel-plugin/cddrive-dialogs.c:682
 #: ../panel-plugin/cddrive.desktop.in.in.h:2
 msgid "CD-ROM drive tray and content control"
 msgstr ""
 
-#: ../panel-plugin/cddrive-dialogs.c:724
+#: ../panel-plugin/cddrive-dialogs.c:725
 msgid "No error description available."
 msgstr ""
 
@@ -406,3 +410,7 @@
 #: ../panel-plugin/cddrive-monitor.c:624
 msgid "Failed to store monitor in HAL context."
 msgstr ""
+
+#: ../panel-plugin/cddrive-monitor.c:1042
+msgid "unknown title"
+msgstr ""




More information about the Goodies-commits mailing list