[Gpredict-svn] SF.net SVN: gpredict:[910] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
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.
|