[Goodies-commits] r7719 - xfburn/trunk/xfburn

David Mohr squisher at xfce.org
Tue Jul 14 03:23:25 CEST 2009


Author: squisher
Date: 2009-07-14 01:23:25 +0000 (Tue, 14 Jul 2009)
New Revision: 7719

Modified:
   xfburn/trunk/xfburn/xfburn-compositions-notebook.c
   xfburn/trunk/xfburn/xfburn-data-composition.c
Log:
Adding date to the default composition name

Modified: xfburn/trunk/xfburn/xfburn-compositions-notebook.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-compositions-notebook.c	2009-07-13 03:24:04 UTC (rev 7718)
+++ xfburn/trunk/xfburn/xfburn-compositions-notebook.c	2009-07-14 01:23:25 UTC (rev 7719)
@@ -27,6 +27,7 @@
 
 #include "xfburn-compositions-notebook.h"
 
+#include "xfburn-global.h"
 #include "xfburn-notebook-tab.h"
 #include "xfburn-welcome-tab.h"
 #include "xfburn-data-composition.h"
@@ -167,7 +168,7 @@
   switch (type) {   
     case XFBURN_DATA_COMPOSITION:
       composition = xfburn_data_composition_new ();
-      label_text = g_strdup_printf ("%s %d", _("Data composition"), ++i);
+      label_text = g_strdup_printf ("%s %d", _(DATA_COMPOSITION_DEFAULT_NAME), ++i);
       break;
     case XFBURN_AUDIO_COMPOSITION:
       composition = xfburn_audio_composition_new ();

Modified: xfburn/trunk/xfburn/xfburn-data-composition.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-data-composition.c	2009-07-13 03:24:04 UTC (rev 7718)
+++ xfburn/trunk/xfburn/xfburn-data-composition.c	2009-07-14 01:23:25 UTC (rev 7719)
@@ -32,6 +32,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <time.h>
 
 #include <gtk/gtk.h>
 #include <libxfce4util/libxfce4util.h>
@@ -289,6 +290,13 @@
                                 { "text/plain;charset=utf-8", 0, DATA_COMPOSITION_DND_TARGET_TEXT_PLAIN },
                               };
 
+  gchar *vol_name;
+  char timestr[80];
+  struct tm *today;
+  time_t tm;
+  /* FIXME: put i into the class? */
+  static int i = 0;
+
   priv->full_paths_to_add = NULL;
 
   instances++;
@@ -348,7 +356,18 @@
   gtk_widget_show (label);
   
   priv->entry_volume_name = gtk_entry_new ();
-  gtk_entry_set_text (GTK_ENTRY (priv->entry_volume_name), _(DATA_COMPOSITION_DEFAULT_NAME));
+
+  tm = time (NULL);
+  today = localtime (&tm);
+
+  if (tm && strftime (timestr, 80, "%Y-%m-%d", today))
+    /* Note to translators: first %s is the date in "i18n" format (year-month-day), %d is a running number of compositions */
+    vol_name = g_strdup_printf (_("Data %s~%d"), timestr, ++i);
+  else
+    vol_name = g_strdup_printf ("%s %d", _(DATA_COMPOSITION_DEFAULT_NAME), ++i);
+
+  gtk_entry_set_text (GTK_ENTRY (priv->entry_volume_name), vol_name);
+  g_free (vol_name);
   gtk_box_pack_start (GTK_BOX (hbox), priv->entry_volume_name, FALSE, FALSE, 0);
   gtk_widget_show (priv->entry_volume_name);
   




More information about the Goodies-commits mailing list