]> git.0d.be Git - empathy.git/commitdiff
add the current date as suffix the the log name
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 7 Apr 2010 15:05:46 +0000 (17:05 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 7 Apr 2010 15:05:46 +0000 (17:05 +0200)
src/empathy-debug-window.c

index ffe3fa0b63049a241961640400ca68060a962990..2cdf9967ca7d1f804877989a951355749ea88ed1 100644 (file)
@@ -1070,7 +1070,10 @@ debug_window_save_clicked_cb (GtkToolButton *tool_button,
     EmpathyDebugWindow *debug_window)
 {
   GtkWidget *file_chooser;
-  gchar *name, *tmp;
+  gchar *name, *tmp = NULL;
+  char time_str[32];
+  time_t t;
+  struct tm *tm_s;
 
   file_chooser = gtk_file_chooser_dialog_new (_("Save"),
       GTK_WINDOW (debug_window), GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -1086,7 +1089,17 @@ debug_window_save_clicked_cb (GtkToolButton *tool_button,
       g_get_tmp_dir ());
 
   name = get_active_cm_name (debug_window);
-  tmp = g_strdup_printf ("%s.log", name);
+
+  t = time (NULL);
+  tm_s = localtime (&t);
+  if (tm_s != NULL)
+    {
+      if (strftime(time_str, sizeof (time_str), "%d-%m-%y_%H-%M-%S", tm_s))
+        tmp = g_strdup_printf ("%s-%s.log", name, time_str);
+    }
+
+  if (tmp == NULL)
+    tmp = g_strdup_printf ("%s.log", name);
   g_free (name);
 
   gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (file_chooser), tmp);