[Gpredict-svn] SF.net SVN: gpredict:[841] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <aa...@us...> - 2011-07-03 23:55:53
|
Revision: 841
http://gpredict.svn.sourceforge.net/gpredict/?rev=841&view=rev
Author: aa1vs
Date: 2011-07-03 23:55:47 +0000 (Sun, 03 Jul 2011)
Log Message:
-----------
Add tle filename as description in new .cat files instead of catalog number.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/tle-update.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-07-03 14:05:23 UTC (rev 840)
+++ trunk/ChangeLog 2011-07-03 23:55:47 UTC (rev 841)
@@ -6,6 +6,10 @@
Show catalog number in satellite selector.
Address 3322786: Show More Information in Edit Module Sat Selection.
+ * src/tle-update.c
+ Add tle filename as description in new .cat files instead of catalog number.
+
+
2011-07-01 Charles Suprin <hamaa1vs at gmail.com>
* src/gtk-sat-map.c
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2011-07-03 14:05:23 UTC (rev 840)
+++ trunk/src/tle-update.c 2011-07-03 23:55:47 UTC (rev 841)
@@ -379,7 +379,6 @@
gchar *cfgstr, *cfgfile;
gsize length, written;
GError *err = NULL;
-
/* check if sat is new */
if (ntle->isnew) {
@@ -441,11 +440,16 @@
/* finally, new satellite must be added to proper category */
gchar *catfile;
gchar **buff;
+ gint statretval;
+ struct stat temp;
buff = g_strsplit (ntle->srcfile, ".", 0);
cfgfile = g_strconcat (buff[0], ".cat", NULL);
catfile = sat_file_name (cfgfile);
+ /* call stat on file before opening it incase file does
+ not exist and we need to add a group name. */
+ statretval = stat (catfile,&temp);
/* g_io_channel */
satfile = g_io_channel_new_file (catfile, "a", &err);
@@ -456,6 +460,15 @@
g_clear_error (&err);
}
else {
+ if (statretval == -1) {
+ /* file did not exist before creating handle */
+ /* use the file name as the group description */
+ cfgstr = g_strdup_printf ("%s\n", buff[0]);
+ g_io_channel_write_chars (satfile, cfgstr, -1, NULL, &err);
+ g_free (cfgstr);
+
+ }
+
cfgstr = g_strdup_printf ("%d\n", ntle->catnum);
g_io_channel_write_chars (satfile, cfgstr, -1, NULL, &err);
g_io_channel_shutdown (satfile, TRUE, NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|