gpredict-svn Mailing List for Gpredict (Page 3)
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
You can subscribe to this list here.
2008 |
Jan
(24) |
Feb
|
Mar
(6) |
Apr
(14) |
May
(9) |
Jun
|
Jul
|
Aug
(25) |
Sep
(60) |
Oct
(26) |
Nov
|
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
(2) |
Mar
(22) |
Apr
(61) |
May
(57) |
Jun
|
Jul
(3) |
Aug
(83) |
Sep
(35) |
Oct
(50) |
Nov
(28) |
Dec
(34) |
2010 |
Jan
(29) |
Feb
(15) |
Mar
(2) |
Apr
|
May
(6) |
Jun
(2) |
Jul
(24) |
Aug
(2) |
Sep
(9) |
Oct
(43) |
Nov
(22) |
Dec
(6) |
2011 |
Jan
(24) |
Feb
(22) |
Mar
(31) |
Apr
(13) |
May
(10) |
Jun
(10) |
Jul
(43) |
Aug
(12) |
Sep
(18) |
Oct
(33) |
Nov
(18) |
Dec
(4) |
From: <aa...@us...> - 2011-10-03 10:27:55
|
Revision: 915 http://gpredict.svn.sourceforge.net/gpredict/?rev=915&view=rev Author: aa1vs Date: 2011-10-03 10:27:48 +0000 (Mon, 03 Oct 2011) Log Message: ----------- Fix segfault in gtk-polar-view-popup.c Modified Paths: -------------- trunk/src/gtk-polar-view-popup.c Modified: trunk/src/gtk-polar-view-popup.c =================================================================== --- trunk/src/gtk-polar-view-popup.c 2011-10-03 00:56:15 UTC (rev 914) +++ trunk/src/gtk-polar-view-popup.c 2011-10-03 10:27:48 UTC (rev 915) @@ -186,6 +186,7 @@ gfloat x,y; guint32 col; guint tres,ttidx; + gint *catnum; /* get satellite object */ @@ -206,16 +207,19 @@ root = goo_canvas_get_root_item_model (GOO_CANVAS (pv->canvas)); + catnum = g_new0 (gint, 1); + *catnum = sat->tle.catnr; + if (obj->showtrack) { /* add sky track */ /* add it to the storage structure */ g_hash_table_insert (pv->showtracks_on, - &(sat->tle.catnr), + catnum, NULL); /* remove it from the don't show */ g_hash_table_remove (pv->showtracks_off, - &(sat->tle.catnr)); + catnum); /* create points */ @@ -284,11 +288,11 @@ else { /* add it to the hide */ g_hash_table_insert (pv->showtracks_off, - &(sat->tle.catnr), + catnum, NULL); /* remove it from the show */ g_hash_table_remove (pv->showtracks_on, - &(sat->tle.catnr)); + catnum); /* delete sky track */ idx = goo_canvas_item_model_find_child (root, obj->track); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-10-03 00:56:21
|
Revision: 914 http://gpredict.svn.sourceforge.net/gpredict/?rev=914&view=rev Author: aa1vs Date: 2011-10-03 00:56:15 +0000 (Mon, 03 Oct 2011) Log Message: ----------- Make groundtrack show on orbit zero. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-sat-map-ground-track.c trunk/src/sgpsdp/sgp4sdp4.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-10-02 23:53:19 UTC (rev 913) +++ trunk/ChangeLog 2011-10-03 00:56:15 UTC (rev 914) @@ -1,5 +1,11 @@ -2011-09-28 Charles Suprin <hamaa1vs at gmail.com> +2011-10-02 Charles Suprin <hamaa1vs at gmail.com> + * src/sgpsdp/sgp4sdp4.h + * src/gtk-sat-map-ground-track.c + Make groundtrack show on orbit zero. (bug 3416451: No ground track for new satellites) + +2011-10-02 Charles Suprin <hamaa1vs at gmail.com> + * src/gtk-sat-map.c * src/gtk-sat-map-ground-track.c Delete ground track of decayed satellite. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-10-02 23:53:19 UTC (rev 913) +++ trunk/NEWS 2011-10-03 00:56:15 UTC (rev 914) @@ -16,8 +16,8 @@ - Fixed bug 3400534: Operational Status. - Fixed bug 3309111: Wrong icon in time controller. - Fixed bug 3413571: UARS Ground Track not Updated on TLE update. +- Fixed bug 3416451: No ground track for new satellites. - Changes in version 1.3 (1 Mar 2011) - Feature request 2873824: Flip Passes. Modified: trunk/src/gtk-sat-map-ground-track.c =================================================================== --- trunk/src/gtk-sat-map-ground-track.c 2011-10-02 23:53:19 UTC (rev 913) +++ trunk/src/gtk-sat-map-ground-track.c 2011-10-03 00:56:15 UTC (rev 914) @@ -71,8 +71,8 @@ void ground_track_create (GtkSatMap *satmap, sat_t *sat, qth_t *qth, sat_map_obj_t *obj) { - unsigned long this_orbit; /* current orbit number */ - unsigned long max_orbit; /* target orbit number, ie. this + num - 1 */ + long this_orbit; /* current orbit number */ + long max_orbit; /* target orbit number, ie. this + num - 1 */ double t0; /* time when this_orbit starts */ double t; ssp_t *this_ssp; Modified: trunk/src/sgpsdp/sgp4sdp4.h =================================================================== --- trunk/src/sgpsdp/sgp4sdp4.h 2011-10-02 23:53:19 UTC (rev 913) +++ trunk/src/sgpsdp/sgp4sdp4.h 2011-10-03 00:56:15 UTC (rev 914) @@ -191,7 +191,7 @@ double footprint; /*!< footprint */ double phase; /*!< orbit phase */ double meanmo; /*!< mean motion kept in rev/day */ - unsigned long orbit; /*!< orbit number */ + long orbit; /*!< orbit number */ orbit_type_t otype; /*!< orbit type. */ } sat_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-10-02 23:53:25
|
Revision: 913 http://gpredict.svn.sourceforge.net/gpredict/?rev=913&view=rev Author: aa1vs Date: 2011-10-02 23:53:19 +0000 (Sun, 02 Oct 2011) Log Message: ----------- Modified Paths: -------------- trunk/ChangeLog Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-10-02 23:48:25 UTC (rev 912) +++ trunk/ChangeLog 2011-10-02 23:53:19 UTC (rev 913) @@ -2,6 +2,7 @@ * src/gtk-sat-map.c * src/gtk-sat-map-ground-track.c + Delete ground track of decayed satellite. 2011-10-01 Alexandru Csete <oz9aec at gmail.com> @@ -9,8 +10,8 @@ * src/gtk-sat-moduile-tmg.c: Use GTK_STOCK_MEDIA_FORWARD and REWIND (bug 3309111: Wrong icon in time controller). - + 2011-09-28 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-10-02 23:48:31
|
Revision: 912 http://gpredict.svn.sourceforge.net/gpredict/?rev=912&view=rev Author: aa1vs Date: 2011-10-02 23:48:25 +0000 (Sun, 02 Oct 2011) Log Message: ----------- Delete ground track of decayed satellite. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-sat-map-ground-track.c trunk/src/gtk-sat-map.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-10-01 10:02:29 UTC (rev 911) +++ trunk/ChangeLog 2011-10-02 23:48:25 UTC (rev 912) @@ -1,3 +1,9 @@ +2011-09-28 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-sat-map.c + * src/gtk-sat-map-ground-track.c + + 2011-10-01 Alexandru Csete <oz9aec at gmail.com> * src/gtk-sat-moduile-tmg.c: Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-10-01 10:02:29 UTC (rev 911) +++ trunk/NEWS 2011-10-02 23:48:25 UTC (rev 912) @@ -15,6 +15,7 @@ - Fixed bug 3271573: Track button in rotator controller has no effect. - Fixed bug 3400534: Operational Status. - Fixed bug 3309111: Wrong icon in time controller. +- Fixed bug 3413571: UARS Ground Track not Updated on TLE update. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/gtk-sat-map-ground-track.c =================================================================== --- trunk/src/gtk-sat-map-ground-track.c 2011-10-01 10:02:29 UTC (rev 911) +++ trunk/src/gtk-sat-map-ground-track.c 2011-10-02 23:48:25 UTC (rev 912) @@ -191,6 +191,11 @@ _("%s: Updating ground track for %s"), __FUNCTION__, sat->nickname); + if (decayed(sat)) { + ground_track_delete (satmap, sat, qth, obj, TRUE); + return; + } + if (recalc == TRUE) { ground_track_delete (satmap, sat, qth, obj, TRUE); ground_track_create (satmap, sat, qth, obj); Modified: trunk/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2011-10-01 10:02:29 UTC (rev 911) +++ trunk/src/gtk-sat-map.c 2011-10-02 23:48:25 UTC (rev 912) @@ -2033,7 +2033,11 @@ if (idx !=-1) goo_canvas_item_model_remove_child (root, idx); g_hash_table_remove (satmap->obj, catnum); - g_free (obj); + if (obj->showtrack) + ground_track_update (satmap, sat, satmap->qth, obj, TRUE); + g_free (obj); + /* remove obj from hash */ + g_hash_table_remove (satmap->obj, catnum); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2011-10-01 10:02:36
|
Revision: 911 http://gpredict.svn.sourceforge.net/gpredict/?rev=911&view=rev Author: csete Date: 2011-10-01 10:02:29 +0000 (Sat, 01 Oct 2011) Log Message: ----------- Use GTK_STOCK_MEDIA_FORWARD and REWIND (bug 3309111). Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-sat-module-tmg.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-28 22:39:39 UTC (rev 910) +++ trunk/ChangeLog 2011-10-01 10:02:29 UTC (rev 911) @@ -1,3 +1,10 @@ +2011-10-01 Alexandru Csete <oz9aec at gmail.com> + + * src/gtk-sat-moduile-tmg.c: + Use GTK_STOCK_MEDIA_FORWARD and REWIND (bug 3309111: Wrong icon in time + controller). + + 2011-09-28 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog @@ -44,15 +51,18 @@ * src/tle-update.c Unifies saving glib key file routine into one place instead of eight. + 2011-09-21 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog * src/tle-update.c - Corrects satellite name not being updated correctly when a satellite occurs with international ID and name in same update. + Corrects satellite name not being updated correctly when a satellite occurs + with international ID and name in same update. * ChangeLog * src/tle-update.c - Corrects satellite status not being updated correctly when a .sat and update data have different status. + Corrects satellite status not being updated correctly when a .sat and update + data have different status. 2011-09-20 Charles Suprin <hamaa1vs at gmail.com> @@ -113,8 +123,8 @@ * src/tle-update.c * src/tle-update.h * src/gtk-sat-data.c - Tracks operational status through tle-update and stores it in .sat files when available. - Fixes Bug 3400534: Operational Status + Tracks operational status through tle-update and stores it in .sat files + when available. Fixes Bug 3400534: Operational Status 2011-08-26 Charles Suprin <hamaa1vs at gmail.com> @@ -129,13 +139,15 @@ * ChangeLog * src/gtk-sat-module.c - Adds Event list to modules support in satellite reload and corrects some error messages. + Adds Event list to modules support in satellite reload and corrects some + error messages. 2011-08-21 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog * src/tle-update.c - Eliminates memory leak and cut and paste error and removes whitespace around tle before importing. + Eliminates memory leak and cut and paste error and removes whitespace around + tle before importing. * ChangeLog * src/gtk-sat-tree.c @@ -149,7 +161,8 @@ * ChangeLog * src/tle-update.c - Updates satellite name and nickname if of form YYYY-NNNAAA indicating first TLE downloaded before celestrak used given name and improves error reporting. + Updates satellite name and nickname if of form YYYY-NNNAAA indicating first + TLE downloaded before celestrak used given name and improves error reporting. 2011-08-09 Charles Suprin <hamaa1vs at gmail.com> @@ -208,7 +221,9 @@ * src/gtk-polar-view.c * src/gtk-sat-tree.h * src/gtk-polar-view.h - Remove deprecated calls and functions to allow make CFLAGS+="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" to work per <http://developer.gnome.org/gtk3/3.0/gtk-migrating-2-to-3.html>. + Remove deprecated calls and functions to allow make + CFLAGS+="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" to work per + <http://developer.gnome.org/gtk3/3.0/gtk-migrating-2-to-3.html>. 2011-07-30 Charles Suprin <hamaa1vs at gmail.com> @@ -222,7 +237,8 @@ * src/gtk-sat-module.h * src/gtk-sat-module-tmg.h * src/gtk-sky-glance.h - Change gtk headers to only include from short list at <http://developer.gnome.org/gtk3/3.0/gtk-migrating-2-to-3.html>. + Change gtk headers to only include from short list at + <http://developer.gnome.org/gtk3/3.0/gtk-migrating-2-to-3.html>. * src/gpredict-help.c * src/gpredict-utils.c @@ -247,7 +263,8 @@ * src/sat-pref-rig-editor.c * src/sat-pref-rot-editor.c * src/save-pass.c - Use access functions instead of private elements per <http://developer.gnome.org/gtk3/3.0/gtk-migrating-2-to-3.html>. + Use access functions instead of private elements per + <http://developer.gnome.org/gtk3/3.0/gtk-migrating-2-to-3.html>. * src/gtk-sat-module-popup.c * src/sat-pref-single-sat.c @@ -268,7 +285,8 @@ * src/sat-pref-single-pass.c * src/gtk-sat-tree.c * src/sat-pref-refresh.c - Eliminate use of deprecated GtkTooltips for GtkTooltip per <http://developer.gnome.org/gtk/2.22/gtk-migrating-tooltips.html>. + Eliminate use of deprecated GtkTooltips for GtkTooltip per + <http://developer.gnome.org/gtk/2.22/gtk-migrating-tooltips.html>. 2011-07-23 Charles Suprin <hamaa1vs at gmail.com> @@ -310,7 +328,8 @@ 2011-06-29 Charles Suprin <hamaa1vs at gmail.com> * src/tle-update.c - Fix SEGFAULT in tle-update.c when unable to open file for writing in network updates. + Fix SEGFAULT in tle-update.c when unable to open file for writing in network + updates. 2011-06-26 Charles Suprin <hamaa1vs at gmail.com> Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-09-28 22:39:39 UTC (rev 910) +++ trunk/NEWS 2011-10-01 10:02:29 UTC (rev 911) @@ -14,6 +14,7 @@ - Fixed bug 3334657: Old log files not being saved. - Fixed bug 3271573: Track button in rotator controller has no effect. - Fixed bug 3400534: Operational Status. +- Fixed bug 3309111: Wrong icon in time controller. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/gtk-sat-module-tmg.c =================================================================== --- trunk/src/gtk-sat-module-tmg.c 2011-09-28 22:39:39 UTC (rev 910) +++ trunk/src/gtk-sat-module-tmg.c 2011-10-01 10:02:29 UTC (rev 911) @@ -92,7 +92,7 @@ mod->tmgFwd = gtk_radio_button_new (NULL); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgFwd), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mod->tmgFwd), TRUE); - image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_FORWARD, GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (mod->tmgFwd), image); gtk_widget_set_tooltip_text (mod->tmgFwd, _("Play forward")); g_signal_connect (mod->tmgFwd, "toggled", G_CALLBACK (tmg_fwd), mod); @@ -110,8 +110,7 @@ /* BWD */ mod->tmgBwd = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (mod->tmgFwd)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgBwd), FALSE); - image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON); - gtk_widget_set_direction (image, GTK_TEXT_DIR_RTL); + image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_REWIND, GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (mod->tmgBwd), image); gtk_widget_set_tooltip_text (mod->tmgBwd, _("Play backwards")); g_signal_connect (mod->tmgBwd, "toggled", G_CALLBACK (tmg_bwd), mod); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-28 22:39:45
|
Revision: 910 http://gpredict.svn.sourceforge.net/gpredict/?rev=910&view=rev Author: aa1vs Date: 2011-09-28 22:39:39 +0000 (Wed, 28 Sep 2011) Log Message: ----------- Save and restore sort information for satellite lists. Modified Paths: -------------- trunk/ChangeLog trunk/src/config-keys.h trunk/src/gtk-sat-list.c trunk/src/gtk-sat-list.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-28 22:22:25 UTC (rev 909) +++ trunk/ChangeLog 2011-09-28 22:39:39 UTC (rev 910) @@ -6,7 +6,13 @@ * src/gtk-event-list.h Save and restore sort information for event lists. + * ChangeLog + * src/config-keys.c + * src/gtk-sat-list.c + * src/gtk-sat-list.h + Save and restore sort information for satellite lists. + 2011-09-25 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/config-keys.h =================================================================== --- trunk/src/config-keys.h 2011-09-28 22:22:25 UTC (rev 909) +++ trunk/src/config-keys.h 2011-09-28 22:39:39 UTC (rev 910) @@ -84,6 +84,8 @@ #define MOD_CFG_LIST_SECTION "LIST" #define MOD_CFG_LIST_COLUMNS "COLUMNS" #define MOD_CFG_LIST_REFRESH "REFRESH" +#define MOD_CFG_LIST_SORT_COLUMN "SORT_COLUMN" +#define MOD_CFG_LIST_SORT_ORDER "SORT_ORDER" /* map specific */ #define MOD_CFG_MAP_SECTION "MAP" Modified: trunk/src/gtk-sat-list.c =================================================================== --- trunk/src/gtk-sat-list.c 2011-09-28 22:22:25 UTC (rev 909) +++ trunk/src/gtk-sat-list.c 2011-09-28 22:39:39 UTC (rev 910) @@ -304,6 +304,14 @@ static void gtk_sat_list_destroy (GtkObject *object) { + GtkSatList *list = GTK_SAT_LIST(object); + + g_key_file_set_integer(list->cfgdata, MOD_CFG_LIST_SECTION, + MOD_CFG_LIST_SORT_COLUMN, list->sort_column); + + g_key_file_set_integer(list->cfgdata, MOD_CFG_LIST_SECTION, + MOD_CFG_LIST_SORT_ORDER, list->sort_order); + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -327,7 +335,37 @@ /* Read configuration data. */ /* ... */ + GTK_SAT_LIST (widget)->cfgdata = cfgdata; + /* read initial sorting criteria */ + GTK_SAT_LIST (widget)->sort_column = SAT_LIST_COL_NAME; + GTK_SAT_LIST (widget)->sort_order = GTK_SORT_ASCENDING; + if (g_key_file_has_key (GTK_SAT_LIST (widget)->cfgdata,MOD_CFG_LIST_SECTION, + MOD_CFG_LIST_SORT_COLUMN, NULL)) { + GTK_SAT_LIST (widget)->sort_column = g_key_file_get_integer (GTK_SAT_LIST (widget)->cfgdata, + MOD_CFG_LIST_SECTION, + MOD_CFG_LIST_SORT_COLUMN, + NULL); + if ((GTK_SAT_LIST (widget)->sort_column >SAT_LIST_COL_NUMBER) + ||(GTK_SAT_LIST (widget)->sort_column<0)) { + GTK_SAT_LIST (widget)->sort_column = SAT_LIST_COL_NAME; + } + } + if (g_key_file_has_key (GTK_SAT_LIST (widget)->cfgdata, + MOD_CFG_EVENT_LIST_SECTION, + MOD_CFG_EVENT_LIST_SORT_ORDER, + NULL)) { + GTK_SAT_LIST (widget)->sort_order = g_key_file_get_integer (GTK_SAT_LIST (widget)->cfgdata, + MOD_CFG_EVENT_LIST_SECTION, + MOD_CFG_EVENT_LIST_SORT_ORDER, + NULL); + if ((GTK_SAT_LIST (widget)->sort_order >1)||(GTK_SAT_LIST (widget)->sort_order<0)) { + GTK_SAT_LIST (widget)->sort_order=GTK_SORT_ASCENDING; + } + } + + + GTK_SAT_LIST (widget)->satellites = sats; GTK_SAT_LIST (widget)->qth = qth; @@ -413,8 +451,8 @@ /* satellite name should be initial sorting criteria */ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), - SAT_LIST_COL_NAME, - GTK_SORT_ASCENDING), + GTK_SAT_LIST(widget)->sort_column, + GTK_SAT_LIST(widget)->sort_order); g_object_unref (model); @@ -555,6 +593,11 @@ /* get and tranverse the model */ model = gtk_tree_view_get_model (GTK_TREE_VIEW (satlist->treeview)); + + /*save the sort information */ + gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model), + &(satlist->sort_column), + &(satlist->sort_order)); /* optimisation: detach model from view while updating */ /* No, we do not do it, because it makes selections and scrolling Modified: trunk/src/gtk-sat-list.h =================================================================== --- trunk/src/gtk-sat-list.h 2011-09-28 22:22:25 UTC (rev 909) +++ trunk/src/gtk-sat-list.h 2011-09-28 22:39:39 UTC (rev 910) @@ -71,7 +71,10 @@ guint counter; /*!< cycle counter */ gdouble tstamp; /*!< time stamp of calculations; set by GtkSatModule */ - + GKeyFile *cfgdata; + gint sort_column; + GtkSortType sort_order; + void (* update) (GtkWidget *widget); /*!< update function */ }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-28 22:22:32
|
Revision: 909 http://gpredict.svn.sourceforge.net/gpredict/?rev=909&view=rev Author: aa1vs Date: 2011-09-28 22:22:25 +0000 (Wed, 28 Sep 2011) Log Message: ----------- Save and restore sort information for event lists. Modified Paths: -------------- trunk/ChangeLog trunk/src/config-keys.h trunk/src/gtk-event-list.c trunk/src/gtk-event-list.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-25 13:27:19 UTC (rev 908) +++ trunk/ChangeLog 2011-09-28 22:22:25 UTC (rev 909) @@ -1,3 +1,12 @@ +2011-09-28 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/config-keys.c + * src/gtk-event-list.c + * src/gtk-event-list.h + Save and restore sort information for event lists. + + 2011-09-25 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/config-keys.h =================================================================== --- trunk/src/config-keys.h 2011-09-25 13:27:19 UTC (rev 908) +++ trunk/src/config-keys.h 2011-09-28 22:22:25 UTC (rev 909) @@ -138,6 +138,7 @@ /* event list */ #define MOD_CFG_EVENT_LIST_SECTION "EVENT_LIST" #define MOD_CFG_EVENT_LIST_REFRESH "REFRESH" +#define MOD_CFG_EVENT_LIST_SORT_COLUMN "SORT_COLUMN" +#define MOD_CFG_EVENT_LIST_SORT_ORDER "SORT_ORDER" - #endif Modified: trunk/src/gtk-event-list.c =================================================================== --- trunk/src/gtk-event-list.c 2011-09-25 13:27:19 UTC (rev 908) +++ trunk/src/gtk-event-list.c 2011-09-28 22:22:25 UTC (rev 909) @@ -211,6 +211,14 @@ static void gtk_event_list_destroy (GtkObject *object) { + GtkEventList *evlist = GTK_EVENT_LIST(object); + + g_key_file_set_integer(evlist->cfgdata, MOD_CFG_EVENT_LIST_SECTION, MOD_CFG_EVENT_LIST_SORT_COLUMN, evlist->sort_column); + + g_key_file_set_integer(evlist->cfgdata, MOD_CFG_EVENT_LIST_SECTION, MOD_CFG_EVENT_LIST_SORT_ORDER, evlist->sort_order); + + + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -232,7 +240,6 @@ GtkTreeViewColumn *column; /* FIXME */ - (void) cfgdata; /* avoid unused warning compiler warning. */ (void) columns; /* avoid unused warning compiler warning. */ widget = g_object_new (GTK_TYPE_EVENT_LIST, NULL); @@ -242,7 +249,37 @@ /* Read configuration data. */ /* ... */ + evlist->cfgdata = cfgdata; + /* read initial sorting criteria */ + evlist->sort_column = EVENT_LIST_COL_TIME; + evlist->sort_order = GTK_SORT_ASCENDING; + if (g_key_file_has_key (evlist->cfgdata,MOD_CFG_EVENT_LIST_SECTION, + MOD_CFG_EVENT_LIST_SORT_COLUMN, NULL)) { + evlist->sort_column = g_key_file_get_integer (evlist->cfgdata, + MOD_CFG_EVENT_LIST_SECTION, + MOD_CFG_EVENT_LIST_SORT_COLUMN, + NULL); + if ((evlist->sort_column >EVENT_LIST_COL_NUMBER) + ||(evlist->sort_column<0)) { + evlist->sort_column = EVENT_LIST_COL_TIME; + } + } + if (g_key_file_has_key (evlist->cfgdata, + MOD_CFG_EVENT_LIST_SECTION, + MOD_CFG_EVENT_LIST_SORT_ORDER, + NULL)) { + evlist->sort_order = g_key_file_get_integer (evlist->cfgdata, + MOD_CFG_EVENT_LIST_SECTION, + MOD_CFG_EVENT_LIST_SORT_ORDER, + NULL); + if ((evlist->sort_order >1)||(evlist->sort_order<0)) { + evlist->sort_order=GTK_SORT_ASCENDING; + } + } + + + evlist->satellites = sats; evlist->qth = qth; @@ -299,8 +336,8 @@ /* initial sorting criteria */ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), - EVENT_LIST_COL_TIME, - GTK_SORT_ASCENDING), + evlist->sort_column, + evlist->sort_order), g_object_unref (model); @@ -393,6 +430,12 @@ /* get and tranverse the model */ model = gtk_tree_view_get_model (GTK_TREE_VIEW (evlist->treeview)); + /*save the sort information */ + gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model), + &(evlist->sort_column), + &(evlist->sort_order)); + + /* update */ gtk_tree_model_foreach (model, event_list_update_sats, evlist); Modified: trunk/src/gtk-event-list.h =================================================================== --- trunk/src/gtk-event-list.h 2011-09-25 13:27:19 UTC (rev 908) +++ trunk/src/gtk-event-list.h 2011-09-28 22:22:25 UTC (rev 909) @@ -69,6 +69,9 @@ guint32 flags; /*!< Flags indicating which columns are visible */ gdouble tstamp; /*!< time stamp of calculations; set by GtkSatModule */ + GKeyFile *cfgdata; + gint sort_column; + GtkSortType sort_order; void (* update) (GtkWidget *widget); /*!< update function */ }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-25 13:27:25
|
Revision: 908 http://gpredict.svn.sourceforge.net/gpredict/?rev=908&view=rev Author: aa1vs Date: 2011-09-25 13:27:19 +0000 (Sun, 25 Sep 2011) Log Message: ----------- Update sort routines to include catalog number to handle ties in name. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-sat-selector.c trunk/src/mod-cfg.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-25 13:04:53 UTC (rev 907) +++ trunk/ChangeLog 2011-09-25 13:27:19 UTC (rev 908) @@ -4,7 +4,12 @@ * src/tle-update.c Fix bugs in tle-update for two line tle's at end of file. + * ChangeLog + * src/gtk-sat-selector.c + * src/mod-cfg.c + Update sort routines to include catalog number to handle ties in name. + 2011-09-22 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/gtk-sat-selector.c =================================================================== --- trunk/src/gtk-sat-selector.c 2011-09-25 13:04:53 UTC (rev 907) +++ trunk/src/gtk-sat-selector.c 2011-09-25 13:27:19 UTC (rev 908) @@ -612,6 +612,7 @@ gpointer userdata) { gchar *sat1,*sat2; + gint catnr1, catnr2; gint ret = 0; (void) userdata; /* avoid unused parameter compiler warning */ @@ -620,6 +621,19 @@ gtk_tree_model_get(model, b, GTK_SAT_SELECTOR_COL_NAME, &sat2, -1); ret = gpredict_strcmp (sat1, sat2); + + if (ret == 0){ + gtk_tree_model_get(model, a, GTK_SAT_SELECTOR_COL_CATNUM, &catnr1, -1); + gtk_tree_model_get(model, b, GTK_SAT_SELECTOR_COL_CATNUM, &catnr2, -1); + if (catnr1 < catnr2) + ret = -1; + else if (catnr1 > catnr2) + ret = 1; + else + /* never supposed to happen */ + ret=0; + } + g_free (sat1); g_free (sat2); Modified: trunk/src/mod-cfg.c =================================================================== --- trunk/src/mod-cfg.c 2011-09-25 13:04:53 UTC (rev 907) +++ trunk/src/mod-cfg.c 2011-09-25 13:27:19 UTC (rev 908) @@ -1100,6 +1100,7 @@ gpointer userdata) { gchar *sat1,*sat2; + gint catnr1,catnr2; gint ret = 0; (void) userdata; /* avoid unused parameter compiler warning */ @@ -1108,7 +1109,20 @@ gtk_tree_model_get(model, b, GTK_SAT_SELECTOR_COL_NAME, &sat2, -1); ret = gpredict_strcmp (sat1, sat2); + + if (ret == 0){ + gtk_tree_model_get(model, a, GTK_SAT_SELECTOR_COL_CATNUM, &catnr1, -1); + gtk_tree_model_get(model, b, GTK_SAT_SELECTOR_COL_CATNUM, &catnr2, -1); + if (catnr1 < catnr2) + ret = -1; + else if (catnr1 > catnr2) + ret = 1; + else + /* never supposed to happen */ + ret=0; + } + g_free (sat1); g_free (sat2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-25 13:04:59
|
Revision: 907 http://gpredict.svn.sourceforge.net/gpredict/?rev=907&view=rev Author: aa1vs Date: 2011-09-25 13:04:53 +0000 (Sun, 25 Sep 2011) Log Message: ----------- Fix bugs in tle-update for two line tle's at end of the file. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-24 12:02:30 UTC (rev 906) +++ trunk/ChangeLog 2011-09-25 13:04:53 UTC (rev 907) @@ -1,3 +1,10 @@ +2011-09-25 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/tle-update.c + Fix bugs in tle-update for two line tle's at end of file. + + 2011-09-22 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-24 12:02:30 UTC (rev 906) +++ trunk/src/tle-update.c 2011-09-25 13:04:53 UTC (rev 907) @@ -796,8 +796,20 @@ gchar category[80]; gboolean catsync = FALSE; /* whether .cat file should be synced */ + /* + Normal cases to check + 1. 3 line tle file as in amatuer.txt from celestrak + 2. 2 line tle file as in .... from celestrak + corner cases to check + 1. 3 line tle with something at the end. (nasa.all from amsat) + 2. 2 line tle with only one in the file + 3. 2 line tle file reading the last one. + */ + + + path = g_strconcat (dir, G_DIR_SEPARATOR_S, fnam, NULL); fp = g_fopen (path, "r"); @@ -847,6 +859,8 @@ satellite catnums will be added during update in the while loop */ } + /* set b to non-null as a flag */ + b = 1; /* read lines from tle file */ while (fgets (linetmp, 80, fp)) { @@ -854,13 +868,31 @@ switch (linesneeded) { case 3: strncpy(tle_working[0],linetmp,80); + /* b is being used a flag here + if b==NULL then we only have one line read in + and there is no way we have a full tle as there + is only one line in the buffer. + A TLE must be two or three lines. + */ b = fgets (tle_working[1], 80, fp); - b = fgets (tle_working[2], 80, fp); + if (b==NULL) { + /* make sure there is no junk in tle_working[1] */ + tle_working[1][0]='\0'; + break; + } + /* make sure there is no junk in tle_working[2] */ + if (fgets (tle_working[2], 80, fp)==NULL) { + tle_working[2][0]='\0'; + } + break; case 2: strncpy(tle_working[0],tle_working[2],80); strncpy(tle_working[1],linetmp,80); - b = fgets (tle_working[2], 80, fp); + /* make sure there is no junk in tle_working[2] */ + if (fgets (tle_working[2], 80, fp)==NULL) { + tle_working[2][0]='\0'; + } break; case 1: strncpy(tle_working[0],tle_working[1],80); @@ -873,6 +905,11 @@ __FILE__, __FUNCTION__, linesneeded); break; } + /* b can only be null if there is only one line in the buffer*/ + /* a tle must be two or three */ + if (b == NULL) { + break; + } /* remove leading and trailing whitespace to be more forgiving */ g_strstrip(tle_working[0]); g_strstrip(tle_working[1]); @@ -929,6 +966,7 @@ /* we appear to have junk read another line in and do nothing else */ linesneeded = 1; + /* skip back to beginning of loop */ continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-24 12:02:36
|
Revision: 906 http://gpredict.svn.sourceforge.net/gpredict/?rev=906&view=rev Author: aa1vs Date: 2011-09-24 12:02:30 +0000 (Sat, 24 Sep 2011) Log Message: ----------- Fix another logic error in name merges. Modified Paths: -------------- trunk/src/tle-update.c Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-23 00:37:27 UTC (rev 905) +++ trunk/src/tle-update.c 2011-09-24 12:02:30 UTC (rev 906) @@ -1018,7 +1018,7 @@ } /* merge based on name */ - if ((!g_regex_match_simple ("\\d{4,}-\\d{3,}",ntle->satname,0,0)) && + if ((g_regex_match_simple ("\\d{4,}-\\d{3,}",ntle->satname,0,0)) && (!g_regex_match_simple ("\\d{4,}-\\d{3,}",tle_str[0],0,0))) { g_free (ntle->satname); ntle->satname = g_strdup (g_strchomp(tle_str[0])); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-23 00:37:34
|
Revision: 905 http://gpredict.svn.sourceforge.net/gpredict/?rev=905&view=rev Author: aa1vs Date: 2011-09-23 00:37:27 +0000 (Fri, 23 Sep 2011) Log Message: ----------- Unifies saving glib key file routine into one place instead of eight. Modified Paths: -------------- trunk/ChangeLog trunk/src/first-time.c trunk/src/gpredict-utils.c trunk/src/gpredict-utils.h trunk/src/mod-cfg.c trunk/src/qth-data.c trunk/src/radio-conf.c trunk/src/rotor-conf.c trunk/src/sat-cfg.c trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/ChangeLog 2011-09-23 00:37:27 UTC (rev 905) @@ -5,6 +5,17 @@ * src/gtk-polar-view-popup.c Saves polarview showtrack information from one session to another. + * ChangeLog + * src/first-time.c + * src/gpredict-utils.c + * src/gpredict-utils.h + * src/mod-cfg.c + * src/qth-data.c + * src/radio-conf.c + * src/rotor-conf.c + * src/sat-cfg.c + * src/tle-update.c + Unifies saving glib key file routine into one place instead of eight. 2011-09-21 Charles Suprin <hamaa1vs at gmail.com> Modified: trunk/src/first-time.c =================================================================== --- trunk/src/first-time.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/first-time.c 2011-09-23 00:37:27 UTC (rev 905) @@ -453,10 +453,7 @@ gchar *satfilename,*targetfilename; gchar *datadir; gchar **satellites; - gchar *cfgstr; GKeyFile *satfile,*target; - gsize length; - gsize written; gsize num; GError *err = NULL; guint i; @@ -464,7 +461,6 @@ //gdouble cfgver; gchar *name, *nickname, *website, *tle1, *tle2, *cfgver; - GIOChannel *cfgfile; GDir *srcdir; gchar *srcdirname; @@ -521,52 +517,14 @@ g_key_file_set_string (target, "Satellite", "TLE1", tle1); g_key_file_set_string (target, "Satellite", "TLE2", tle2); - /* convert configuration data struct to charachter string */ - cfgstr = g_key_file_to_data (target, &length, NULL); /* this function never reports error */ - - /* create and open a file for writing */ - cfgfile = g_io_channel_new_file (targetfilename, "w", &err); - - if (err != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create satellite file (%s)."), - __FUNCTION__, err->message); - g_clear_error (&err); + if (gpredict_save_key_file ( target, targetfilename)) { *error |= FTC_ERROR_STEP_05; + } else { + newsats++; } - else { - g_io_channel_write_chars (cfgfile, - cfgstr, - length, - &written, - &err); - - g_io_channel_shutdown (cfgfile, TRUE, NULL); - g_io_channel_unref (cfgfile); - - if (err != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error writing satellite data (%s)."), - __FUNCTION__, err->message); - g_clear_error (&err); - *error |= FTC_ERROR_STEP_05; - } - else if (length != written) { - sat_log_log (SAT_LOG_LEVEL_WARN, - _("%s: Wrote only %d out of %d chars for satellite data."), - __FUNCTION__, written, length); - } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Satellite data written for %s."), - __FUNCTION__, satellites[i]); - newsats++; - } - } - + g_key_file_free (target); - g_free (cfgstr); g_free (cfgver); g_free (name); g_free (nickname); Modified: trunk/src/gpredict-utils.c =================================================================== --- trunk/src/gpredict-utils.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/gpredict-utils.c 2011-09-23 00:37:27 UTC (rev 905) @@ -458,6 +458,11 @@ return col; } +/** \brief String comparison function + * \param s1 first string + * \param s2 second string + */ + int gpredict_strcmp (const char *s1, const char *s2) { #if 0 @@ -475,6 +480,16 @@ #endif } + +/** \brief substring finding function + * \param s1 the larger string + * \param s2 the substring that we are searching for. + * \return pointer to the substring location + * + * this is a substitute for strcasestr which is a gnu c extension and not available everywhere. + */ + + char * gpredict_strcasestr(const char *s1, const char *s2) { size_t s1_len = strlen(s1); @@ -489,3 +504,83 @@ return NULL; } + +/** \brief Save a GKeyFile structure to a file + * \param cfgdata is a pointer to the GKeyFile. + * \param filename is a pointer the filename string. + * \return 1 on error and zero on success. + * This might one day be in glib but for now it is not a standard function. + * Variants of this were throughout the code and it is now consilidated here. + */ + +gboolean gpredict_save_key_file (GKeyFile *cfgdata, const char *filename) { + gchar *datastream; /* cfgdata string */ + gsize length; /* length of the data stream */ + gsize written; /* number of bytes actually written */ + gboolean err = 0; /* the error value */ + GIOChannel *cfgfile; /* file */ + GError *error = NULL; /* Error handler */ + + /* ok, go on and convert the data */ + datastream = g_key_file_to_data (cfgdata, &length, &error); + + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Could not create config data (%s)."), + __FUNCTION__, error->message); + + g_clear_error (&error); + + err = 1; + } else { + cfgfile = g_io_channel_new_file (filename, "w", &error); + + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Could not create config file (%s)."), + __FUNCTION__, error->message); + + g_clear_error (&error); + + err = 1; + } + else { + g_io_channel_write_chars (cfgfile, + datastream, + length, + &written, + &error); + + g_io_channel_shutdown (cfgfile, TRUE, NULL); + g_io_channel_unref (cfgfile); + + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error writing config data (%s)."), + __FUNCTION__, error->message); + + g_clear_error (&error); + + err = 1; + } + else if (length != written) { + sat_log_log (SAT_LOG_LEVEL_WARN, + _("%s: Wrote only %d out of %d chars."), + __FUNCTION__, written, length); + + err = 1; + } + else { + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Configuration saved for %s."), + __FUNCTION__, filename); + + err = 0; + } + } + } + g_free (datastream); + + return err; + +} Modified: trunk/src/gpredict-utils.h =================================================================== --- trunk/src/gpredict-utils.h 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/gpredict-utils.h 2011-09-23 00:37:27 UTC (rev 905) @@ -64,4 +64,5 @@ gchar *rgba2html (guint rgba); int gpredict_strcmp (const char *s1, const char *s2); char *gpredict_strcasestr(const char *s1, const char *s2); +gboolean gpredict_save_key_file (GKeyFile *cfgdata, const char *filename); #endif Modified: trunk/src/mod-cfg.c =================================================================== --- trunk/src/mod-cfg.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/mod-cfg.c 2011-09-23 00:37:27 UTC (rev 905) @@ -310,13 +310,8 @@ */ mod_cfg_status_t mod_cfg_save (gchar *modname, GKeyFile *cfgdata) { - GError *error = NULL; /* Error handler */ - gchar *datastream; /* cfgdata string */ - GIOChannel *cfgfile; /* .mod file */ gchar *filename; /* file name */ gchar *confdir; - gsize length; /* length of the data stream */ - gsize written; /* number of bytes actually written */ gboolean err; @@ -335,71 +330,14 @@ return MOD_CFG_ERROR; } - /* ok, go on and convert the data */ - datastream = g_key_file_to_data (cfgdata, &length, &error); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create config data (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - return MOD_CFG_ERROR; - } - + /* create file and write data stream */ confdir = get_modules_dir (); filename = g_strconcat (confdir, G_DIR_SEPARATOR_S, modname, ".mod", NULL); g_free (confdir); - cfgfile = g_io_channel_new_file (filename, "w", &error); + err = gpredict_save_key_file (cfgdata, filename); - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create config file (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - err = 1; - } - else { - g_io_channel_write_chars (cfgfile, - datastream, - length, - &written, - &error); - - g_io_channel_shutdown (cfgfile, TRUE, NULL); - g_io_channel_unref (cfgfile); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error writing config data (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - err = 1; - } - else if (length != written) { - sat_log_log (SAT_LOG_LEVEL_WARN, - _("%s: Wrote only %d out of %d chars."), - __FUNCTION__, written, length); - - err = 1; - } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Configuration saved for module %s."), - __FUNCTION__, modname); - - err = 0; - } - } - - g_free (datastream); g_free (filename); if (err) Modified: trunk/src/qth-data.c =================================================================== --- trunk/src/qth-data.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/qth-data.c 2011-09-23 00:37:27 UTC (rev 905) @@ -40,6 +40,7 @@ #include "orbit-tools.h" #include "time-tools.h" #include "locator.h" +#include "gpredict-utils.h" #ifdef HAS_LIBGPS # include <gps.h> #endif @@ -279,12 +280,7 @@ gint qth_data_save (const gchar *filename, qth_t *qth) { - GError *error = NULL; gchar *buff; - GIOChannel *cfgfile; - gsize length; - gsize written; - gchar *cfgstr; gint ok = 1; qth->data = g_key_file_new (); @@ -369,69 +365,8 @@ /* saving code */ - /* convert configuration data struct to charachter string */ - cfgstr = g_key_file_to_data (qth->data, &length, &error); + ok = !(gpredict_save_key_file (qth->data, filename)); - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create QTH data (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - ok = 0; - } - else { - - cfgfile = g_io_channel_new_file (filename, "w", &error); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create QTH file %s\n%s."), - __FUNCTION__, filename, error->message); - - g_clear_error (&error); - - ok = 0; - } - else { - g_io_channel_write_chars (cfgfile, - cfgstr, - length, - &written, - &error); - - g_io_channel_shutdown (cfgfile, TRUE, NULL); - g_io_channel_unref (cfgfile); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error writing QTH data (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - ok = 0; - } - else if (length != written) { - sat_log_log (SAT_LOG_LEVEL_WARN, - _("%s: Wrote only %d out of %d chars."), - __FUNCTION__, written, length); - - ok = 0; - } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: QTH data saved."), - __FUNCTION__); - - ok = 1; - } - } - - g_free (cfgstr); - } - return ok; } Modified: trunk/src/radio-conf.c =================================================================== --- trunk/src/radio-conf.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/radio-conf.c 2011-09-23 00:37:27 UTC (rev 905) @@ -31,6 +31,7 @@ #include <glib/gi18n.h> #include "sat-log.h" #include "compat.h" +#include "gpredict-utils.h" #include "radio-conf.h" @@ -216,8 +217,6 @@ GKeyFile *cfg = NULL; gchar *confdir; gchar *fname; - gchar *data; - gsize len; if (conf->name == NULL) { sat_log_log (SAT_LOG_LEVEL_ERROR, @@ -240,22 +239,14 @@ g_key_file_set_integer (cfg, GROUP, KEY_VFO_UP, conf->vfoUp); g_key_file_set_integer (cfg, GROUP, KEY_VFO_DOWN, conf->vfoDown); } - - /* convert to text sdata */ - data = g_key_file_to_data (cfg, &len, NULL); - + confdir = get_hwconf_dir(); fname = g_strconcat (confdir, G_DIR_SEPARATOR_S, conf->name, ".rig", NULL); g_free (confdir); - - g_file_set_contents (fname, data, len, NULL); + + gpredict_save_key_file (cfg, fname); g_free (fname); - g_free (data); g_key_file_free (cfg); - - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Saved radio configuration %s"), - __FUNCTION__, conf->name); } Modified: trunk/src/rotor-conf.c =================================================================== --- trunk/src/rotor-conf.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/rotor-conf.c 2011-09-23 00:37:27 UTC (rev 905) @@ -33,6 +33,7 @@ #include "compat.h" #include "rotor-conf.h" +#include "gpredict-utils.h" #define GROUP "Rotator" #define KEY_HOST "Host" @@ -172,8 +173,6 @@ GKeyFile *cfg = NULL; gchar *confdir; gchar *fname; - gchar *data; - gsize len; if (conf->name == NULL) return; @@ -189,17 +188,16 @@ g_key_file_set_double (cfg, GROUP, KEY_MINEL, conf->minel); g_key_file_set_double (cfg, GROUP, KEY_MAXEL, conf->maxel); - /* convert to text sdata */ - data = g_key_file_to_data (cfg, &len, NULL); - + /* build filename */ confdir = get_hwconf_dir(); fname = g_strconcat (confdir, G_DIR_SEPARATOR_S, conf->name, ".rot", NULL); g_free (confdir); - g_file_set_contents (fname, data, len, NULL); - + /* save information */ + gpredict_save_key_file (cfg, fname); + + /* cleanup */ g_free (fname); - g_free (data); g_key_file_free (cfg); } Modified: trunk/src/sat-cfg.c =================================================================== --- trunk/src/sat-cfg.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/sat-cfg.c 2011-09-23 00:37:27 UTC (rev 905) @@ -45,8 +45,8 @@ #include "sat-pass-dialogs.h" #include "compat.h" #include "sat-cfg.h" +#include "gpredict-utils.h" - #define LIST_COLUMNS_DEFAULTS (SAT_LIST_FLAG_NAME |\ SAT_LIST_FLAG_AZ |\ SAT_LIST_FLAG_EL |\ @@ -311,82 +311,17 @@ */ guint sat_cfg_save () { - gsize length; - gsize written; - GError *error = NULL; - gchar *cfgstr; gchar *keyfile; gchar *confdir; - GIOChannel *cfgfile; guint err = 0; + + confdir = get_user_conf_dir (); + keyfile = g_strconcat (confdir, G_DIR_SEPARATOR_S, "gpredict.cfg", NULL); + + err = gpredict_save_key_file( config , keyfile); - /* convert configuration data struct to charachter string */ - cfgstr = g_key_file_to_data (config, &length, &error); + g_free (confdir); - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create config data (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - err = 1; - } - else { - /* create and open a file for writing */ - confdir = get_user_conf_dir (); - keyfile = g_strconcat (confdir, G_DIR_SEPARATOR_S, "gpredict.cfg", NULL); - g_free (confdir); - cfgfile = g_io_channel_new_file (keyfile, "w", &error); - g_free (keyfile); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create config file (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - err = 1; - } - else { - g_io_channel_write_chars (cfgfile, - cfgstr, - length, - &written, - &error); - - g_io_channel_shutdown (cfgfile, TRUE, NULL); - g_io_channel_unref (cfgfile); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error writing config data (%s)."), - __FUNCTION__, error->message); - - g_clear_error (&error); - - err = 1; - } - else if (length != written) { - sat_log_log (SAT_LOG_LEVEL_WARN, - _("%s: Wrote only %d out of %d chars."), - __FUNCTION__, written, length); - - err = 1; - } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Configuration saved."), - __FUNCTION__); - - err = 0; - } - } - - g_free (cfgstr); - } - return err; } Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-23 00:33:36 UTC (rev 904) +++ trunk/src/tle-update.c 2011-09-23 00:37:27 UTC (rev 905) @@ -39,8 +39,8 @@ #include "sat-cfg.h" #include "compat.h" #include "tle-update.h" +#include "gpredict-utils.h" - /* Flag indicating whether TLE update is in progress. This should avoid multiple attempts to update TLE, e.g. user starts update from menubar while automatic @@ -165,7 +165,6 @@ /* scan directory for tle files */ while ((fnam = g_dir_read_name (cache_dir)) != NULL) { - /* check that we got a TLE file */ if (is_tle_file(dir, fnam)) { @@ -188,6 +187,8 @@ /* now, do read the fresh data */ num = read_fresh_tle (dir, fnam, data); + } else { + num = 0; } if (num < 1) { @@ -405,7 +406,6 @@ GKeyFile *satdata; GIOChannel *satfile; gchar *cfgstr, *cfgfile; - gsize length, written; GError *err = NULL; (void) key; /* avoid unused parameter compiler warning */ @@ -423,45 +423,13 @@ g_key_file_set_string (satdata, "Satellite", "TLE2", ntle->line2); g_key_file_set_integer (satdata, "Satellite", "STATUS", ntle->status); - /* convert data to text */ - cfgstr = g_key_file_to_data (satdata, &length, NULL); - /* create an I/O channel and store data */ cfgfile = sat_file_name_from_catnum (ntle->catnum); - satfile = g_io_channel_new_file (cfgfile, "w", &err); - - if (err != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create satellite file (%s)."), - __FUNCTION__, err->message); - g_clear_error (&err); + if (!gpredict_save_key_file (satdata, cfgfile)){ + *num += 1; } - else { - g_io_channel_write_chars (satfile, cfgstr, length, &written, &err); - g_io_channel_shutdown (satfile, TRUE, NULL); - g_io_channel_unref (satfile); - if (err != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error writing satellite data for %d (%s)."), - __FUNCTION__, ntle->catnum, err->message); - g_clear_error (&err); - } - else if (length != written) { - sat_log_log (SAT_LOG_LEVEL_WARN, - _("%s: Wrote only %d out of %d chars for satellite data %d."), - __FUNCTION__, written, length, ntle->catnum); - } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Data for new sat %d successfully added."), - __FUNCTION__, ntle->catnum); - *num += 1; - } - } - /* clean up memory */ - g_free (cfgstr); g_free (cfgfile); g_key_file_free (satdata); @@ -1129,9 +1097,6 @@ GError *error = NULL; GKeyFile *satdata; gchar *tlestr1, *tlestr2, *rawtle, *satname, *satnickname; - gchar *cfgstr; - GIOChannel *cfgfile; - gsize length, written; gboolean updateddata; @@ -1272,46 +1237,12 @@ } if (updateddata ==TRUE) { - /* convert configuration data struct to charachter string */ - cfgstr = g_key_file_to_data (satdata, &length, NULL); /* this function never reports error */ - - /* create and open a file for writing */ - cfgfile = g_io_channel_new_file (path, "w", &error); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create satellite data file (%s)."), - __FUNCTION__, error->message); - g_clear_error (&error); + if (gpredict_save_key_file(satdata, path)) { skipped++; + } else { + updated++; } - else { - g_io_channel_write_chars (cfgfile, cfgstr, length, &written, &error); - - g_io_channel_shutdown (cfgfile, TRUE, NULL); - g_io_channel_unref (cfgfile); - - if (error != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error writing satellite data (%s)."), - __FUNCTION__, error->message); - g_clear_error (&error); - skipped++; - } - else if (length != written) { - sat_log_log (SAT_LOG_LEVEL_WARN, - _("%s: Wrote only %d out of %d chars for satellite data."), - __FUNCTION__, written, length); - skipped++; - } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Satellite data written for %d."), - __FUNCTION__, catnr); - updated++; - } - } - g_free (cfgstr); + } else { skipped++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-23 00:33:42
|
Revision: 904 http://gpredict.svn.sourceforge.net/gpredict/?rev=904&view=rev Author: aa1vs Date: 2011-09-23 00:33:36 +0000 (Fri, 23 Sep 2011) Log Message: ----------- Add keys for polar tracks. Modified Paths: -------------- trunk/src/config-keys.h Modified: trunk/src/config-keys.h =================================================================== --- trunk/src/config-keys.h 2011-09-23 00:13:07 UTC (rev 903) +++ trunk/src/config-keys.h 2011-09-23 00:33:36 UTC (rev 904) @@ -126,8 +126,9 @@ #define MOD_CFG_POLAR_TRACK_COL "TRACK_COLOUR" #define MOD_CFG_POLAR_INFO_COL "INFO_COLOUR" #define MOD_CFG_POLAR_FONT "TEXT_FONT" +#define MOD_CFG_POLAR_SHOWTRACKS "SHOWTRACKS" +#define MOD_CFG_POLAR_HIDETRACKS "HIDETRACKS" - /* single sat */ #define MOD_CFG_SINGLE_SAT_SECTION "SINGLE_SAT" #define MOD_CFG_SINGLE_SAT_REFRESH "REFRESH" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-23 00:13:14
|
Revision: 903 http://gpredict.svn.sourceforge.net/gpredict/?rev=903&view=rev Author: aa1vs Date: 2011-09-23 00:13:07 +0000 (Fri, 23 Sep 2011) Log Message: ----------- Saves polarview showtrack information from one session to another. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-polar-view-popup.c trunk/src/gtk-polar-view.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-21 20:25:08 UTC (rev 902) +++ trunk/ChangeLog 2011-09-23 00:13:07 UTC (rev 903) @@ -1,3 +1,11 @@ +2011-09-22 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/gtk-polar-view.c + * src/gtk-polar-view-popup.c + Saves polarview showtrack information from one session to another. + + 2011-09-21 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/gtk-polar-view-popup.c =================================================================== --- trunk/src/gtk-polar-view-popup.c 2011-09-21 20:25:08 UTC (rev 902) +++ trunk/src/gtk-polar-view-popup.c 2011-09-23 00:13:07 UTC (rev 903) @@ -208,7 +208,16 @@ if (obj->showtrack) { /* add sky track */ + + /* add it to the storage structure */ + g_hash_table_insert (pv->showtracks_on, + &(sat->tle.catnr), + NULL); + /* remove it from the don't show */ + g_hash_table_remove (pv->showtracks_off, + &(sat->tle.catnr)); + /* create points */ num = g_slist_length (obj->pass->details); if (num == 0) { @@ -273,6 +282,13 @@ } else { + /* add it to the hide */ + g_hash_table_insert (pv->showtracks_off, + &(sat->tle.catnr), + NULL); + /* remove it from the show */ + g_hash_table_remove (pv->showtracks_on, + &(sat->tle.catnr)); /* delete sky track */ idx = goo_canvas_item_model_find_child (root, obj->track); Modified: trunk/src/gtk-polar-view.c =================================================================== --- trunk/src/gtk-polar-view.c 2011-09-21 20:25:08 UTC (rev 902) +++ trunk/src/gtk-polar-view.c 2011-09-23 00:13:07 UTC (rev 903) @@ -92,8 +92,11 @@ static GooCanvasItemModel* create_canvas_model (GtkPolarView *polv); static void get_canvas_bg_color (GtkPolarView *polv, GdkColor *color); static gchar *los_time_to_str (GtkPolarView *polv, sat_t *sat); +static void gtk_polar_view_store_showtracks (GtkPolarView *pv); +static void gtk_polar_view_load_showtracks (GtkPolarView *pv); +static void store_binary_hash_cfgdata (GKeyFile *cfgdata, GHashTable *hash, const gchar *cfgsection, const gchar *cfgkey) ; +static void load_integer_list_boolean (GKeyFile *cfgdata,const gchar* section,const gchar *key,GHashTable *dest); - static GtkVBoxClass *parent_class = NULL; @@ -172,6 +175,7 @@ static void gtk_polar_view_destroy (GtkObject *object) { + gtk_polar_view_store_showtracks ( GTK_POLAR_VIEW(object)); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -249,6 +253,7 @@ MOD_CFG_POLAR_SECTION, MOD_CFG_POLAR_SHOW_EXTRA_AZ_TICKS, SAT_CFG_BOOL_POL_SHOW_EXTRA_AZ_TICKS); + gtk_polar_view_load_showtracks (GTK_POLAR_VIEW(polv)); /* create the canvas */ GTK_POLAR_VIEW (polv)->canvas = goo_canvas_new (); @@ -1002,9 +1007,19 @@ NULL); g_free (tooltip); + if (goo_canvas_item_model_find_child(root, obj->marker) != -1) + goo_canvas_item_model_raise (obj->marker, NULL); + else + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: marker added to polarview not showing %d."), + __FUNCTION__, *catnum); - goo_canvas_item_model_raise (obj->marker, NULL); - goo_canvas_item_model_raise (obj->label, NULL); + if (goo_canvas_item_model_find_child(root, obj->label) != -1) + goo_canvas_item_model_raise (obj->label, NULL); + else + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: label added to polarview not showing %d."), + __FUNCTION__, *catnum); g_object_set_data (G_OBJECT (obj->marker), "catnum", GINT_TO_POINTER(*catnum)); g_object_set_data (G_OBJECT (obj->label), "catnum", GINT_TO_POINTER(*catnum)); @@ -1745,3 +1760,112 @@ return text; } + +static void +gtk_polar_view_store_showtracks (GtkPolarView *pv) { + store_binary_hash_cfgdata(pv->cfgdata, + pv->showtracks_on, + MOD_CFG_POLAR_SECTION, + MOD_CFG_POLAR_SHOWTRACKS); + store_binary_hash_cfgdata(pv->cfgdata, + pv->showtracks_off, + MOD_CFG_POLAR_SECTION, + MOD_CFG_POLAR_HIDETRACKS); +} + +/** \brief Load the satellites that we should not highlight coverage */ +static void +gtk_polar_view_load_showtracks (GtkPolarView *pv) +{ + load_integer_list_boolean(pv->cfgdata, + MOD_CFG_POLAR_SECTION, + MOD_CFG_POLAR_HIDETRACKS, + pv->showtracks_off); + + load_integer_list_boolean(pv->cfgdata, + MOD_CFG_POLAR_SECTION, + MOD_CFG_POLAR_SHOWTRACKS, + pv->showtracks_on); + +} + +/** \brief Load an integer list into a hash table that uses the + existinence of datain the hash as a boolean. + It loads NULL's into the hash table. +*/ +static void load_integer_list_boolean (GKeyFile *cfgdata,const gchar* section,const gchar *key,GHashTable *dest) { + gint *sats = NULL; + gsize length; + GError *error = NULL; + guint i; + guint *tkey; + + sats = g_key_file_get_integer_list (cfgdata, + section, + key, + &length, + &error); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Failed to get list of satellites (%s)"), + __FUNCTION__, error->message); + + g_clear_error (&error); + + /* GLib API says nothing about the contents in case of error */ + if (sats) { + g_free (sats); + } + + return; + } + + /* read each satellite into hash table */ + for (i = 0; i < length; i++) { + tkey = g_new0 (guint, 1); + *tkey = sats[i]; + //printf("loading sat %d\n",sats[i]); + if (!(g_hash_table_lookup_extended (dest, tkey, NULL, NULL))) { + /* just add a one to the value so there is presence indicator */ + g_hash_table_insert (dest, + tkey, + NULL); + } + } + g_free(sats); +} + +/** \brief Convert the "boolean" hash back into an integer list and + save it to the cfgdata. */ +static void +store_binary_hash_cfgdata (GKeyFile *cfgdata, GHashTable *hash, const gchar *cfgsection, const gchar *cfgkey) +{ + gint *showtrack; + gint *something; + gint i,length; + GList *keys = g_hash_table_get_keys(hash); + + length = g_list_length(keys); + if (g_list_length(keys)>0) { + + showtrack = g_try_new0(gint,g_list_length(keys)); + for (i=0;i<length;i++) { + something=g_list_nth_data(keys,i); + showtrack[i]=*something; + } + g_key_file_set_integer_list (cfgdata, + cfgsection, + cfgkey, + showtrack, + g_list_length(keys) + ); + + } else { + g_key_file_remove_key(cfgdata, + cfgsection, + cfgkey, + NULL); + } + + g_list_free (keys); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-21 20:25:14
|
Revision: 902 http://gpredict.svn.sourceforge.net/gpredict/?rev=902&view=rev Author: aa1vs Date: 2011-09-21 20:25:08 +0000 (Wed, 21 Sep 2011) Log Message: ----------- Corrects satellite status not being updated correctly when a .sat and update data have different status. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-21 20:05:06 UTC (rev 901) +++ trunk/ChangeLog 2011-09-21 20:25:08 UTC (rev 902) @@ -2,9 +2,13 @@ * ChangeLog * src/tle-update.c - Corrects satellite name not being update correctly when a satellite occurs with international ID and name in same update. + Corrects satellite name not being updated correctly when a satellite occurs with international ID and name in same update. + * ChangeLog + * src/tle-update.c + Corrects satellite status not being updated correctly when a .sat and update data have different status. + 2011-09-20 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-21 20:05:06 UTC (rev 901) +++ trunk/src/tle-update.c 2011-09-21 20:25:08 UTC (rev 902) @@ -1250,15 +1250,6 @@ g_free(satname); g_free(satnickname); - if ( status != ntle->status ){ - - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Data for %d updated for operational status."), - __FUNCTION__, catnr); - g_key_file_set_integer (satdata, "Satellite", "STATUS", ntle->status); - updateddata = TRUE; - } - if (tle.epoch < ntle->epoch) { /* new data is newer than what we already have */ /* store new data */ @@ -1267,8 +1258,17 @@ __FUNCTION__, catnr); g_key_file_set_string (satdata, "Satellite", "TLE1", ntle->line1); g_key_file_set_string (satdata, "Satellite", "TLE2", ntle->line2); + g_key_file_set_integer (satdata, "Satellite", "STATUS", ntle->status); updateddata = TRUE; + } else if (tle.epoch == ntle->epoch) { + if ((status != ntle->status) && (ntle->status != OP_STAT_UNKNOWN)){ + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Data for %d updated for operational status."), + __FUNCTION__, catnr); + g_key_file_set_integer (satdata, "Satellite", "STATUS", ntle->status); + updateddata = TRUE; + } } if (updateddata ==TRUE) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-21 20:05:12
|
Revision: 901 http://gpredict.svn.sourceforge.net/gpredict/?rev=901&view=rev Author: aa1vs Date: 2011-09-21 20:05:06 +0000 (Wed, 21 Sep 2011) Log Message: ----------- Corrects satellite name not being update correctly when a satellite occurs with international ID and name in same update. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-21 02:35:04 UTC (rev 900) +++ trunk/ChangeLog 2011-09-21 20:05:06 UTC (rev 901) @@ -1,3 +1,10 @@ +2011-09-21 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/tle-update.c + Corrects satellite name not being update correctly when a satellite occurs with international ID and name in same update. + + 2011-09-20 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-21 02:35:04 UTC (rev 900) +++ trunk/src/tle-update.c 2011-09-21 20:05:06 UTC (rev 901) @@ -1017,6 +1017,8 @@ else { /* satellite is already in hash */ /* apply various merge routines */ + + /*time merge */ if (ntle->epoch == tle.epoch) { /* if satellite epoch has the same time, merge status as appropriate */ if ( (ntle->status != tle.status) && ( ntle->status != OP_STAT_UNKNOWN )) { @@ -1038,8 +1040,6 @@ ntle->catnum = catnr; ntle->epoch = tle.epoch; ntle->status = tle.status; - g_free (ntle->satname); - ntle->satname = g_strdup (g_strchomp(tle_str[0])); g_free (ntle->line1); ntle->line1 = g_strdup (tle_str[1]); g_free (ntle->line2); @@ -1048,8 +1048,18 @@ ntle->srcfile = g_strdup (fnam); ntle->isnew = TRUE; /* flag will be reset when using data */ } + + /* merge based on name */ + if ((!g_regex_match_simple ("\\d{4,}-\\d{3,}",ntle->satname,0,0)) && + (!g_regex_match_simple ("\\d{4,}-\\d{3,}",tle_str[0],0,0))) { + g_free (ntle->satname); + ntle->satname = g_strdup (g_strchomp(tle_str[0])); + } + /* free the key since we do not commit it to the cache */ g_free (key); + + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-21 02:35:10
|
Revision: 900 http://gpredict.svn.sourceforge.net/gpredict/?rev=900&view=rev Author: aa1vs Date: 2011-09-21 02:35:04 +0000 (Wed, 21 Sep 2011) Log Message: ----------- Eliminate segfaults for some .sat file corruption. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-sat-data.c trunk/src/sgpsdp/sgp_in.c trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-19 21:24:02 UTC (rev 899) +++ trunk/ChangeLog 2011-09-21 02:35:04 UTC (rev 900) @@ -1,3 +1,12 @@ +2011-09-20 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/sgpsdp/sgp_in.c + * src/tle-update.c + * src/gtk-sat-data.c + Eliminate segfaults for some .sat file corruption. + + 2011-09-19 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/gtk-sat-data.c =================================================================== --- trunk/src/gtk-sat-data.c 2011-09-19 21:24:02 UTC (rev 899) +++ trunk/src/gtk-sat-data.c 2011-09-21 02:35:04 UTC (rev 900) @@ -99,7 +99,19 @@ /* get TLE data */ tlestr1 = g_key_file_get_string (data, "Satellite", "TLE1", NULL); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading TLE line 1 from %s (%s)"), + __FUNCTION__, path, error->message); + g_clear_error (&error); + } tlestr2 = g_key_file_get_string (data, "Satellite", "TLE2", NULL); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading TLE line 2 from %s (%s)"), + __FUNCTION__, path, error->message); + g_clear_error (&error); + } rawtle = g_strconcat (tlestr1, tlestr2, NULL); @@ -108,9 +120,9 @@ _("%s: TLE data for %d appears to be bad"), __FUNCTION__, catnum); errorcode = 2; + } else { + Convert_Satellite_Data (rawtle, &sat->tle); } - Convert_Satellite_Data (rawtle, &sat->tle); - if (g_key_file_has_key(data, "Satellite", "STATUS",NULL)) sat->tle.status = g_key_file_get_integer (data, "Satellite", "STATUS", NULL); Modified: trunk/src/sgpsdp/sgp_in.c =================================================================== --- trunk/src/sgpsdp/sgp_in.c 2011-09-19 21:24:02 UTC (rev 899) +++ trunk/src/sgpsdp/sgp_in.c 2011-09-21 02:35:04 UTC (rev 900) @@ -54,7 +54,11 @@ Checksum_Good (char *tle_set) { int i, check_digit, value, checksum = 0; - + + if ( tle_set == NULL ) { + return 0; + } + for (i = 0; i < 68; i++) { if ( (tle_set[i] >= '0') && (tle_set[i] <= '9') ) value = tle_set[i] - '0'; Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-19 21:24:02 UTC (rev 899) +++ trunk/src/tle-update.c 2011-09-21 02:35:04 UTC (rev 900) @@ -880,7 +880,7 @@ } - /* read 3 lines at a time */ + /* read lines from tle file */ while (fgets (linetmp, 80, fp)) { /*read in the number of lines needed to potentially get to a new tle*/ switch (linesneeded) { @@ -1166,9 +1166,25 @@ /* get TLE data */ tlestr1 = g_key_file_get_string (satdata, "Satellite", "TLE1", NULL); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading TLE line 2 from %s (%s)"), + __FUNCTION__, path, error->message); + g_clear_error (&error); + } tlestr2 = g_key_file_get_string (satdata, "Satellite", "TLE2", NULL); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading TLE line 2 from %s (%s)"), + __FUNCTION__, path, error->message); + g_clear_error (&error); + } + + /* get name data */ satname = g_key_file_get_string (satdata, "Satellite", "NAME", NULL); satnickname = g_key_file_get_string (satdata, "Satellite", "NICKNAME", NULL); + + /* get status data */ if (g_key_file_has_key(satdata,"Satellite","STATUS", NULL)) { status = g_key_file_get_integer (satdata, "Satellite", "STATUS", NULL); } @@ -1182,9 +1198,11 @@ sat_log_log (SAT_LOG_LEVEL_WARN, _("%s: Current TLE data for %d appears to be bad"), __FUNCTION__, catnr); + /* set epoch to zero so it gets overwritten */ + tle.epoch = 0; + } else { + Convert_Satellite_Data (rawtle, &tle); } - Convert_Satellite_Data (rawtle, &tle); - g_free (tlestr1); g_free (tlestr2); g_free (rawtle); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-19 21:24:09
|
Revision: 899 http://gpredict.svn.sourceforge.net/gpredict/?rev=899&view=rev Author: aa1vs Date: 2011-09-19 21:24:02 +0000 (Mon, 19 Sep 2011) Log Message: ----------- Process bare tle's based on checksums. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-19 12:00:59 UTC (rev 898) +++ trunk/ChangeLog 2011-09-19 21:24:02 UTC (rev 899) @@ -1,3 +1,10 @@ +2011-09-19 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/tle-update.c + Process bare tle's based on checksums. + + 2011-09-18 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-09-19 12:00:59 UTC (rev 898) +++ trunk/NEWS 2011-09-19 21:24:02 UTC (rev 899) @@ -4,6 +4,7 @@ - Feature request 3141555: gpsd support. - Feature request 2130926: Change frequency using mouse wheel. Also for rotator controller. - Feature request 3322786: Show More Information in Edit Module Sat Selection. +- Feature request 3314813: Resolves Requested TLE files from Celestrak. - Applied and extended patch 3237220: natural sort for sat list in module config - Improve handling of decayed satellites. - Fixed bug 3250344: Win32 build not working with hamlib. Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-19 12:00:59 UTC (rev 898) +++ trunk/src/tle-update.c 2011-09-19 21:24:02 UTC (rev 899) @@ -811,11 +811,15 @@ tle_t tle; gchar *path; gchar tle_str[3][80]; + gchar tle_working[3][80]; + gchar linetmp[80]; + guint linesneeded = 3; gchar catstr[6]; + gchar idstr[7]="\0\0\0\0\0\0\0",idyearstr[3]; gchar *b; FILE *fp; gint retcode = 0; - guint catnr,i; + guint catnr,i,idyear; guint *key = NULL; /* category sync related */ @@ -877,16 +881,90 @@ /* read 3 lines at a time */ - while (fgets (tle_str[0], 80, fp)) { - /* read second and third lines */ - b = fgets (tle_str[1], 80, fp); - b = fgets (tle_str[2], 80, fp); - + while (fgets (linetmp, 80, fp)) { + /*read in the number of lines needed to potentially get to a new tle*/ + switch (linesneeded) { + case 3: + strncpy(tle_working[0],linetmp,80); + b = fgets (tle_working[1], 80, fp); + b = fgets (tle_working[2], 80, fp); + break; + case 2: + strncpy(tle_working[0],tle_working[2],80); + strncpy(tle_working[1],linetmp,80); + b = fgets (tle_working[2], 80, fp); + break; + case 1: + strncpy(tle_working[0],tle_working[1],80); + strncpy(tle_working[1],tle_working[2],80); + strncpy(tle_working[2],linetmp,80); + break; + default: + sat_log_log (SAT_LOG_LEVEL_BUG, + _("%s:%s: Something wrote linesneeded to an illegal value %d"), + __FILE__, __FUNCTION__, linesneeded); + break; + } /* remove leading and trailing whitespace to be more forgiving */ - g_strstrip(tle_str[0]); - g_strstrip(tle_str[1]); - g_strstrip(tle_str[2]); + g_strstrip(tle_working[0]); + g_strstrip(tle_working[1]); + g_strstrip(tle_working[2]); + /* there are three possibilities at this point */ + /* first is that line 0 is a name and normal text for three line element and that lines 1 and 2 + are the corresponding tle */ + /* second is that line 0 and line 1 are a tle for a bare tle */ + /* third is that neither of these is true and we are consuming either text at the top of the + file or a text file that happens to be in the update directory + */ + if (Checksum_Good(tle_working[1]) && (tle_working[1][0]=='1')) { + sat_log_log (SAT_LOG_LEVEL_DEBUG, + _("%s:%s: Processing a three line TLE"), + __FILE__, __FUNCTION__); + + /* it appears that the first line may be a name followed by a tle */ + strncpy(tle_str[0],tle_working[0],80); + strncpy(tle_str[1],tle_working[1],80); + strncpy(tle_str[2],tle_working[2],80); + /* we consumed three lines so we need three lines */ + linesneeded = 3; + + } else if (Checksum_Good(tle_working[0]) && (tle_working[0][0]=='1')) { + sat_log_log (SAT_LOG_LEVEL_DEBUG, + _("%s:%s: Processing a bare two line TLE"), + __FILE__, __FUNCTION__); + + /* first line appears to belong to the start of bare TLE */ + /* put in a dummy name of form yyyy-nnaa base on international id */ + /* this special form will be overwritten if a three line tle ever has another name */ + + strncpy(idstr,&tle_working[0][11],6); + g_strstrip(idstr); + strncpy(idyearstr,&tle_working[0][9],2); + idstr[6]= '\0'; + idyearstr[2]= '\0'; + idyear = g_ascii_strtod(idyearstr,NULL); + + /* there is a two digit year field that started around sputnik */ + if (idyear >= 57) + idyear += 1900; + else + idyear += 2000; + + snprintf(tle_str[0],79,"%d-%s",idyear,idstr); + strncpy(tle_str[1],tle_working[0],80); + strncpy(tle_str[2],tle_working[1],80); + + /* we consumed two lines so we need two lines */ + linesneeded = 2; + } else { + /* we appear to have junk + read another line in and do nothing else */ + linesneeded = 1; + continue; + } + + tle_str[1][69] = '\0'; tle_str[2][69] = '\0'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-19 12:01:10
|
Revision: 898 http://gpredict.svn.sourceforge.net/gpredict/?rev=898&view=rev Author: aa1vs Date: 2011-09-19 12:00:59 +0000 (Mon, 19 Sep 2011) Log Message: ----------- Speed up tle-update by updating the gui less frequently. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-18 14:09:26 UTC (rev 897) +++ trunk/ChangeLog 2011-09-19 12:00:59 UTC (rev 898) @@ -1,6 +1,13 @@ 2011-09-18 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog + * src/tle-update.c + Speed up tle-update by updating the gui less frequently. + + +2011-09-18 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog * src/qth-data.c Remove error message if latitude, longitude, or altitude is zero. Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-18 14:09:26 UTC (rev 897) +++ trunk/src/tle-update.c 2011-09-19 12:00:59 UTC (rev 898) @@ -326,18 +326,28 @@ } - /* Force the drawing queue to be processed otherwise there will - not be any visual feedback, ie. frozen GUI - - see Gtk+ FAQ http://www.gtk.org/faq/#AEN602 - */ - while (g_main_context_iteration (NULL, FALSE)); - - /* give user a chance to follow progress */ - g_usleep (G_USEC_PER_SEC / 1000); + /* update the gui only every so often to speed up the process */ + /* 47 was selected empirically to balance the update looking smooth but not take too much time. */ + /* it also tumbles all digits in the numbers so that there is no obvious pattern. */ + /* on a developer machine this improved an update from 5 minutes to under 20 seconds. */ + if (total%47 == 0) { + /* Force the drawing queue to be processed otherwise there will + not be any visual feedback, ie. frozen GUI + - see Gtk+ FAQ http://www.gtk.org/faq/#AEN602 + */ + while (g_main_context_iteration (NULL, FALSE)); + + /* give user a chance to follow progress */ + g_usleep (G_USEC_PER_SEC / 1000); + } } } } + + /* force gui update */ + while (g_main_context_iteration (NULL, FALSE)); + /* close directory handle */ g_dir_close (loc_dir); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-18 14:09:32
|
Revision: 897 http://gpredict.svn.sourceforge.net/gpredict/?rev=897&view=rev Author: aa1vs Date: 2011-09-18 14:09:26 +0000 (Sun, 18 Sep 2011) Log Message: ----------- Remove error message if latitude, longitude, or altitude is zero. Modified Paths: -------------- trunk/ChangeLog trunk/src/qth-data.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-07 23:31:58 UTC (rev 896) +++ trunk/ChangeLog 2011-09-18 14:09:26 UTC (rev 897) @@ -1,3 +1,10 @@ +2011-09-18 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/qth-data.c + Remove error message if latitude, longitude, or altitude is zero. + + 2011-09-07 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/qth-data.c =================================================================== --- trunk/src/qth-data.c 2011-09-07 23:31:58 UTC (rev 896) +++ trunk/src/qth-data.c 2011-09-18 14:09:26 UTC (rev 897) @@ -766,20 +766,20 @@ */ void qth_validate(qth_t*qth){ /* check that the values are not set to nonsense such as nan or inf. if so error it and set to zero. */ - if (!isnormal(qth->lat)){ + if (!isnormal(qth->lat) && (qth->lat != 0)){ sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: QTH data had bogus lat %f"), __FUNCTION__,qth->lat); qth->lat=0.0; } - if (!isnormal(qth->lon)){ + if (!isnormal(qth->lon) && (qth->lon != 0)){ sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: QTH data had bogus lon %f"), __FUNCTION__,qth->lon); qth->lon=0.0; } - if (!isnormal(qth->alt)){ + if (!isnormal(qth->alt) && (qth->alt != 0)){ sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: QTH data had bogus alt %f"), __FUNCTION__,qth->alt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-07 23:32:04
|
Revision: 896 http://gpredict.svn.sourceforge.net/gpredict/?rev=896&view=rev Author: aa1vs Date: 2011-09-07 23:31:58 +0000 (Wed, 07 Sep 2011) Log Message: ----------- Update progress bar calculation for tle update. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-07 01:17:30 UTC (rev 895) +++ trunk/ChangeLog 2011-09-07 23:31:58 UTC (rev 896) @@ -2,6 +2,13 @@ * ChangeLog * src/tle-update.c + Update progress bar calculation for tle update. + + +2011-09-07 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/tle-update.c Save status for new satellites. Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-07 01:17:30 UTC (rev 895) +++ trunk/src/tle-update.c 2011-09-07 23:31:58 UTC (rev 896) @@ -296,15 +296,31 @@ } if (progress != NULL) { - - /* calculate and saturate fraction - (number of sats in TLE files is greater - than the number of sats in link table) - */ - fraction = start + (1.0-start) * ((gdouble) total) / ((gdouble) num); - if (fraction >= 0.95) - fraction = 0.98; - + /* two different calculations for completeness depending on whether + we are adding new satellites or not. */ + if (sat_cfg_get_bool (SAT_CFG_BOOL_TLE_ADD_NEW)) { + /* In this case we are possibly processing more than num satellites + How many more? We do not know yet. Worst case is g_hash_table_size more. + + As we update skipped and updated we can reduce the denominator count + as those are in both pools (files and hash table). When we have processed + all the files, updated and skipped are completely correct and the progress + is correct. It may be correct sooner if the missed satellites are the + last files to process. + + Until then, if we eliminate the ones that are updated and skipped from being + double counted, our progress will shown will always be less or equal to our + true progress since the denominator will be larger than is correct. + + Advantages to this are that the progress bar does not stall close to + finished when there are a large number of new satellites. + */ + fraction = start + (1.0-start) * ((gdouble) total) / + ((gdouble) num + g_hash_table_size(data) - updated - skipped); + } else { + /* here we only process satellites we have have files for so divide by num */ + fraction = start + (1.0-start) * ((gdouble) total) / ((gdouble) num); + } gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), fraction); @@ -644,7 +660,7 @@ if (!silent && (progress != NULL)) { /* complete download corresponds to 50% */ - fraction = start + (0.5-start) * i / (2.0 * numfiles); + fraction = start + (0.5-start) * i / (1.0 * numfiles); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), fraction); /* Force the drawing queue to be processed otherwise there will This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-07 01:17:36
|
Revision: 895 http://gpredict.svn.sourceforge.net/gpredict/?rev=895&view=rev Author: aa1vs Date: 2011-09-07 01:17:30 +0000 (Wed, 07 Sep 2011) Log Message: ----------- Save status for new satellites. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-04 23:14:07 UTC (rev 894) +++ trunk/ChangeLog 2011-09-07 01:17:30 UTC (rev 895) @@ -1,3 +1,10 @@ +2011-09-07 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/tle-update.c + Save status for new satellites. + + 2011-09-04 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-04 23:14:07 UTC (rev 894) +++ trunk/src/tle-update.c 2011-09-07 01:17:30 UTC (rev 895) @@ -395,6 +395,7 @@ g_key_file_set_string (satdata, "Satellite", "NICKNAME", ntle->satname); g_key_file_set_string (satdata, "Satellite", "TLE1", ntle->line1); g_key_file_set_string (satdata, "Satellite", "TLE2", ntle->line2); + g_key_file_set_integer (satdata, "Satellite", "STATUS", ntle->status); /* convert data to text */ cfgstr = g_key_file_to_data (satdata, &length, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-04 23:14:13
|
Revision: 894 http://gpredict.svn.sourceforge.net/gpredict/?rev=894&view=rev Author: aa1vs Date: 2011-09-04 23:14:07 +0000 (Sun, 04 Sep 2011) Log Message: ----------- Cleanup comments and code with satellite status updates. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-01 11:39:20 UTC (rev 893) +++ trunk/ChangeLog 2011-09-04 23:14:07 UTC (rev 894) @@ -1,3 +1,10 @@ +2011-09-04 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * src/tle-update.c + Cleanup comments and code with satellite status updates. + + 2011-09-01 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-09-01 11:39:20 UTC (rev 893) +++ trunk/src/tle-update.c 2011-09-04 23:14:07 UTC (rev 894) @@ -889,9 +889,11 @@ /* add data to hash table */ key = g_try_new0 (guint, 1); *key = catnr; - + + ntle = g_hash_table_lookup (data, key); + /* check if satellite already in hash table */ - if (g_hash_table_lookup (data, key) == NULL) { + if ( ntle == NULL) { /* create new_tle structure */ ntle = g_try_new (new_tle_t, 1); @@ -908,23 +910,26 @@ retcode++; } else { - /* if the satellite in the hash is older than - the one just loaded, copy the values over. */ - ntle = g_hash_table_lookup (data, key); + /* satellite is already in hash */ + /* apply various merge routines */ if (ntle->epoch == tle.epoch) { - if (ntle->status!=tle.status) { - if (tle.status != OP_STAT_UNKNOWN) { - if (ntle->status!= OP_STAT_UNKNOWN) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s:%s: Two different statuses for the same satellite at the same time."), - __FILE__, __FUNCTION__); - - } - ntle->status = tle.status; + /* if satellite epoch has the same time, merge status as appropriate */ + if ( (ntle->status != tle.status) && ( ntle->status != OP_STAT_UNKNOWN )) { + /* update status */ + ntle->status = tle.status; + if ( tle.status != OP_STAT_UNKNOWN ) { + /* log if there is something funny about the data coming in */ + sat_log_log (SAT_LOG_LEVEL_WARN, + _("%s:%s: Two different statuses for %s:%d at the same time."), + __FILE__, __FUNCTION__, ntle->satname,ntle->catnum); + } } } - else if (ntle->epoch <tle.epoch) { + else if ( ntle->epoch < tle.epoch ) { + /* if the satellite in the hash is older than + the one just loaded, copy the values over. */ + ntle->catnum = catnr; ntle->epoch = tle.epoch; ntle->status = tle.status; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-09-01 11:39:27
|
Revision: 893 http://gpredict.svn.sourceforge.net/gpredict/?rev=893&view=rev Author: aa1vs Date: 2011-09-01 11:39:20 +0000 (Thu, 01 Sep 2011) Log Message: ----------- Tracks operational status through tle-update and stores it in .sat files when available. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-sat-data.c trunk/src/tle-update.c trunk/src/tle-update.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/ChangeLog 2011-09-01 11:39:20 UTC (rev 893) @@ -1,3 +1,14 @@ +2011-09-01 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * NEWS + * src/tle-update.c + * src/tle-update.h + * src/gtk-sat-data.c + Tracks operational status through tle-update and stores it in .sat files when available. + Fixes Bug 3400534: Operational Status + + 2011-08-26 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/NEWS 2011-09-01 11:39:20 UTC (rev 893) @@ -12,6 +12,7 @@ - Fixed bug 3272993: Issue controlling Yaesu FT-847. - Fixed bug 3334657: Old log files not being saved. - Fixed bug 3271573: Track button in rotator controller has no effect. +- Fixed bug 3400534: Operational Status. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/gtk-sat-data.c =================================================================== --- trunk/src/gtk-sat-data.c 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/src/gtk-sat-data.c 2011-09-01 11:39:20 UTC (rev 893) @@ -100,6 +100,7 @@ /* get TLE data */ tlestr1 = g_key_file_get_string (data, "Satellite", "TLE1", NULL); tlestr2 = g_key_file_get_string (data, "Satellite", "TLE2", NULL); + rawtle = g_strconcat (tlestr1, tlestr2, NULL); if (!Good_Elements (rawtle)) { @@ -109,6 +110,9 @@ errorcode = 2; } Convert_Satellite_Data (rawtle, &sat->tle); + + if (g_key_file_has_key(data, "Satellite", "STATUS",NULL)) + sat->tle.status = g_key_file_get_integer (data, "Satellite", "STATUS", NULL); g_free (tlestr1); g_free (tlestr2); Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/src/tle-update.c 2011-09-01 11:39:20 UTC (rev 893) @@ -532,7 +532,6 @@ gchar *userconfdir; CURL *curl; CURLcode res; - gboolean error = FALSE; gdouble fraction,start=0; FILE *outfile; GDir *dir; @@ -626,7 +625,6 @@ sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: Error fetching %s (%s)"), __FUNCTION__, curfile, curl_easy_strerror (res)); - error = TRUE; } else { sat_log_log (SAT_LOG_LEVEL_MSG, @@ -818,6 +816,11 @@ catfile = g_fopen (catpath, "r"); if (catfile!=NULL) { b = fgets (category, 80, catfile); + if (b == NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: There is no category in %s"), + __FILE__, __FUNCTION__, catpath); + } fclose (catfile); catsync = TRUE; } @@ -894,6 +897,7 @@ ntle = g_try_new (new_tle_t, 1); ntle->catnum = catnr; ntle->epoch = tle.epoch; + ntle->status = tle.status; ntle->satname = g_strdup (g_strchomp(tle_str[0])); ntle->line1 = g_strdup (tle_str[1]); ntle->line2 = g_strdup (tle_str[2]); @@ -907,10 +911,23 @@ /* if the satellite in the hash is older than the one just loaded, copy the values over. */ ntle = g_hash_table_lookup (data, key); - - if (ntle->epoch <tle.epoch) { + if (ntle->epoch == tle.epoch) { + if (ntle->status!=tle.status) { + if (tle.status != OP_STAT_UNKNOWN) { + if (ntle->status!= OP_STAT_UNKNOWN) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: Two different statuses for the same satellite at the same time."), + __FILE__, __FUNCTION__); + + } + ntle->status = tle.status; + } + } + } + else if (ntle->epoch <tle.epoch) { ntle->catnum = catnr; ntle->epoch = tle.epoch; + ntle->status = tle.status; g_free (ntle->satname); ntle->satname = g_strdup (g_strchomp(tle_str[0])); g_free (ntle->line1); @@ -988,6 +1005,7 @@ guint *key = NULL; tle_t tle; new_tle_t *ntle; + op_stat_t status; GError *error = NULL; GKeyFile *satdata; gchar *tlestr1, *tlestr2, *rawtle, *satname, *satnickname; @@ -1041,6 +1059,13 @@ tlestr2 = g_key_file_get_string (satdata, "Satellite", "TLE2", NULL); satname = g_key_file_get_string (satdata, "Satellite", "NAME", NULL); satnickname = g_key_file_get_string (satdata, "Satellite", "NICKNAME", NULL); + if (g_key_file_has_key(satdata,"Satellite","STATUS", NULL)) { + status = g_key_file_get_integer (satdata, "Satellite", "STATUS", NULL); + } + else { + status = OP_STAT_UNKNOWN; + } + rawtle = g_strconcat (tlestr1, tlestr2, NULL); if (!Good_Elements (rawtle)) { @@ -1086,7 +1111,16 @@ g_free(satname); g_free(satnickname); - + + if ( status != ntle->status ){ + + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Data for %d updated for operational status."), + __FUNCTION__, catnr); + g_key_file_set_integer (satdata, "Satellite", "STATUS", ntle->status); + updateddata = TRUE; + } + if (tle.epoch < ntle->epoch) { /* new data is newer than what we already have */ /* store new data */ Modified: trunk/src/tle-update.h =================================================================== --- trunk/src/tle-update.h 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/src/tle-update.h 2011-09-01 11:39:20 UTC (rev 893) @@ -65,6 +65,7 @@ gchar *line2; /*!< Line 2. */ gchar *srcfile; /*!< The file where TLE comes from (needed for cat) */ gboolean isnew; /*!< Flag indicating whether sat is new. */ + op_stat_t status; /*!< Enum indicating current satellite status. */ } new_tle_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-08-26 15:32:12
|
Revision: 892 http://gpredict.svn.sourceforge.net/gpredict/?rev=892&view=rev Author: aa1vs Date: 2011-08-26 15:32:06 +0000 (Fri, 26 Aug 2011) Log Message: ----------- Add hashes to support storing polar view sky track on and off. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-polar-view.c trunk/src/gtk-polar-view.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-08-23 10:19:23 UTC (rev 891) +++ trunk/ChangeLog 2011-08-26 15:32:06 UTC (rev 892) @@ -1,6 +1,14 @@ -2011-08-21 Charles Suprin <hamaa1vs at gmail.com> +2011-08-26 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog + * src/gtk-polar-view.h + * src/gtk-polar-view.c + Add hashes to support storing polar view sky track on and off. + + +2011-08-23 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog * src/gtk-sat-module.c Adds Event list to modules support in satellite reload and corrects some error messages. Modified: trunk/src/gtk-polar-view.c =================================================================== --- trunk/src/gtk-polar-view.c 2011-08-23 10:19:23 UTC (rev 891) +++ trunk/src/gtk-polar-view.c 2011-08-26 15:32:06 UTC (rev 892) @@ -201,6 +201,16 @@ g_free, NULL); + GTK_POLAR_VIEW (polv)->showtracks_on = g_hash_table_new_full (g_int_hash, + g_int_equal, + g_free, + NULL); + + GTK_POLAR_VIEW (polv)->showtracks_off = g_hash_table_new_full (g_int_hash, + g_int_equal, + g_free, + NULL); + /* get settings */ GTK_POLAR_VIEW (polv)->refresh = mod_cfg_get_int (cfgdata, MOD_CFG_POLAR_SECTION, @@ -832,7 +842,7 @@ } /* free pass info */ - free_pass (obj->pass); + //free_pass (obj->pass); obj->pass=NULL; /* if this was the selected satellite we need to @@ -842,7 +852,7 @@ g_object_set (polv->sel, "text", "", NULL); } - g_free (obj); + // g_free (obj); /* remove sat object from hash table */ g_hash_table_remove (polv->obj, catnum); @@ -946,7 +956,15 @@ if ( obj != NULL) { /* space was allocated now use it */ obj->selected = FALSE; - obj->showtrack = polv->showtrack; + + if (g_hash_table_lookup_extended(polv->showtracks_on,catnum,NULL,NULL)){ + obj->showtrack = TRUE; + } + else if (g_hash_table_lookup_extended(polv->showtracks_off,catnum,NULL,NULL)){ + obj->showtrack = FALSE; + } else { + obj->showtrack = polv->showtrack; + } obj->istarget = FALSE; root = goo_canvas_get_root_item_model (GOO_CANVAS (polv->canvas)); Modified: trunk/src/gtk-polar-view.h =================================================================== --- trunk/src/gtk-polar-view.h 2011-08-23 10:19:23 UTC (rev 891) +++ trunk/src/gtk-polar-view.h 2011-08-26 15:32:06 UTC (rev 892) @@ -104,6 +104,9 @@ GooCanvasItemModel *next; /*!< next event text */ GooCanvasItemModel *sel; /*!< Text showing info about selected satellite. */ + GHashTable *showtracks_on; + GHashTable *showtracks_off; + gdouble naos; /*!< Next event time */ gint ncat; /*!< Next event catnum */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-08-23 10:19:29
|
Revision: 891 http://gpredict.svn.sourceforge.net/gpredict/?rev=891&view=rev Author: aa1vs Date: 2011-08-23 10:19:23 +0000 (Tue, 23 Aug 2011) Log Message: ----------- Adds Event list to modules support in satellite reload and corrects some error messages. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-sat-module.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-08-21 14:00:19 UTC (rev 890) +++ trunk/ChangeLog 2011-08-23 10:19:23 UTC (rev 891) @@ -1,6 +1,12 @@ 2011-08-21 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog + * src/gtk-sat-module.c + Adds Event list to modules support in satellite reload and corrects some error messages. + +2011-08-21 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog * src/tle-update.c Eliminates memory leak and cut and paste error and removes whitespace around tle before importing. Modified: trunk/src/gtk-sat-module.c =================================================================== --- trunk/src/gtk-sat-module.c 2011-08-21 14:00:19 UTC (rev 890) +++ trunk/src/gtk-sat-module.c 2011-08-23 10:19:23 UTC (rev 891) @@ -934,7 +934,7 @@ else { sat_log_log (SAT_LOG_LEVEL_BUG, - _("%f:%d: Unknown child type"), + _("%s:%d: Unknown child type"), __FILE__, __LINE__); } } @@ -1514,11 +1514,13 @@ else if (IS_GTK_SAT_LIST (widget)) { } + else if (IS_GTK_EVENT_LIST (widget)) { + } else { sat_log_log (SAT_LOG_LEVEL_BUG, - _("%f:%d: Unknown child type"), + _("%s:%d: Unknown child type"), __FILE__, __LINE__); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |