[Gpredict-svn] SF.net SVN: gpredict:[421] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <cs...@us...> - 2009-08-23 16:34:41
|
Revision: 421 http://gpredict.svn.sourceforge.net/gpredict/?rev=421&view=rev Author: csete Date: 2009-08-23 16:34:15 +0000 (Sun, 23 Aug 2009) Log Message: ----------- sync Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-sat-selector.c trunk/src/gtk-sat-selector.h trunk/src/mod-cfg.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-08-23 15:02:04 UTC (rev 420) +++ trunk/ChangeLog 2009-08-23 16:34:15 UTC (rev 421) @@ -1,3 +1,9 @@ +2009-08-23 Alexandru Csete <oz9aec at gmail.com> + + * src/gtk-sat-selector.[ch]: + Added files with new satellite selector. + + 2009-08-12 Alexandru Csete <oz9aec at gmail.com> * src/gtk-sat-module-tmg.c: Modified: trunk/src/gtk-sat-selector.c =================================================================== --- trunk/src/gtk-sat-selector.c 2009-08-23 15:02:04 UTC (rev 420) +++ trunk/src/gtk-sat-selector.c 2009-08-23 16:34:15 UTC (rev 421) @@ -35,7 +35,9 @@ #ifdef HAVE_CONFIG_H # include <build-config.h> #endif +#include "sgpsdp/sgp4sdp4.h" #include "sat-log.h" +#include "gtk-sat-data.h" #include "compat.h" #include "gtk-sat-selector.h" @@ -239,24 +241,90 @@ /** FIXME: flags not needed here */ static void create_and_fill_models (GtkSatSelector *selector) { - GtkTreeStore *store; /* the list store data structure */ + GtkListStore *store; /* the list store data structure */ GtkTreeIter node; /* new top level node added to the tree store */ GDir *dir; gchar *dirname; + sat_t sat; + gint catnum; + gchar *path; gchar *nodename; gchar **buffv; const gchar *fname; + guint num = 0; - /* load all satellites into solector->models[0] */ + /* load all satellites into selector->models[0] */ + store = gtk_list_store_new (GTK_SAT_SELECTOR_COL_NUM, + G_TYPE_STRING, // name + G_TYPE_INT, // catnum + G_TYPE_STRING // epoch + ); + selector->models = g_slist_append (selector->models, store); + dirname = get_satdata_dir (); + dir = g_dir_open (dirname, 0, NULL); + if (!dir) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: Failed to open satdata directory %s."), + __FILE__, __FUNCTION__, dirname); + g_free (dirname); + + return; + } + + /* Scan data directory for .tle files. + For each file scan through the file and + add entry to the tree. + */ + while ((fname = g_dir_read_name (dir))) { + + if (g_strrstr (fname, ".sat")) { + + buffv = g_strsplit (fname, ".", 0); + catnum = (gint) g_ascii_strtoll (buffv[0], NULL, 0); + + if (gtk_sat_data_read_sat (catnum, &sat)) { + /* error */ + } + else { + /* read satellite */ + + gtk_list_store_append (store, &node); + gtk_list_store_set (store, &node, + GTK_SAT_SELECTOR_COL_NAME, sat.nickname, + GTK_SAT_SELECTOR_COL_CATNUM, catnum, + -1); + + g_free (sat.name); + g_free (sat.nickname); + num++; + } + + g_strfreev (buffv); + } + } + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s:%s: Read %d satellites into MAIN group."), + __FILE__, __FUNCTION__, num); + /* load satellites from each .cat file into selector->models[i] */ + g_dir_rewind (dir); + while ((fname = g_dir_read_name (dir))) { + if (g_strrstr (fname, ".cat")) { + } + } + + g_dir_close (dir); + g_free (dirname); + + #if 0 /* create a new tree store */ store = gtk_tree_store_new (GTK_SAT_SELECTOR_COL_NUM, Modified: trunk/src/gtk-sat-selector.h =================================================================== --- trunk/src/gtk-sat-selector.h 2009-08-23 15:02:04 UTC (rev 420) +++ trunk/src/gtk-sat-selector.h 2009-08-23 16:34:15 UTC (rev 421) @@ -55,7 +55,7 @@ -#define GTK_SAT_SELECTOR_DEFAULT_FLAGS (GTK_SAT_SELECTOR_FLAG_NAME) +#define GTK_SAT_SELECTOR_DEFAULT_FLAGS (GTK_SAT_SELECTOR_FLAG_NAME | GTK_SAT_SELECTOR_COL_CATNUM) #define GTK_TYPE_SAT_SELECTOR (gtk_sat_selector_get_type ()) Modified: trunk/src/mod-cfg.c =================================================================== --- trunk/src/mod-cfg.c 2009-08-23 15:02:04 UTC (rev 420) +++ trunk/src/mod-cfg.c 2009-08-23 16:34:15 UTC (rev 421) @@ -71,6 +71,8 @@ #include "mod-cfg.h" +#include "gtk-sat-selector.h" + extern GtkWidget *app; @@ -597,6 +599,8 @@ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tree, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), gtk_sat_selector_new (0), TRUE, TRUE, 0); + gtk_widget_show_all (GTK_DIALOG (dialog)->vbox); return dialog; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |