[Gpredict-svn] SF.net SVN: gpredict:[876] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <aa...@us...> - 2011-07-24 01:17:26
|
Revision: 876
http://gpredict.svn.sourceforge.net/gpredict/?rev=876&view=rev
Author: aa1vs
Date: 2011-07-24 01:17:14 +0000 (Sun, 24 Jul 2011)
Log Message:
-----------
Save and restore current module on closing.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/mod-mgr.c
trunk/src/sat-cfg.c
trunk/src/sat-cfg.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-07-16 01:02:39 UTC (rev 875)
+++ trunk/ChangeLog 2011-07-24 01:17:14 UTC (rev 876)
@@ -1,3 +1,10 @@
+2011-07-23 Charles Suprin <hamaa1vs at gmail.com>
+
+ * src/sat-cfg.[ch]
+ * src/mod-mgr.c
+ Save and restore the current module on closing.
+
+
2011-07-07 Charles Suprin <hamaa1vs at gmail.com>
* src/gtk-polar-view.c
Modified: trunk/src/mod-mgr.c
===================================================================
--- trunk/src/mod-mgr.c 2011-07-16 01:02:39 UTC (rev 875)
+++ trunk/src/mod-mgr.c 2011-07-24 01:17:14 UTC (rev 876)
@@ -101,6 +101,7 @@
GtkWidget *module;
gchar *modfile;
gchar *confdir;
+ gint page;
/* create notebook */
nbook = gtk_notebook_new ();
@@ -112,6 +113,7 @@
/* get list of modules which should be open */
openmods = sat_cfg_get_str (SAT_CFG_STR_OPEN_MODULES);
+ page = sat_cfg_get_int (SAT_CFG_INT_MODULE_CURRENT_PAGE);
if (openmods) {
mods = g_strsplit (openmods, ";", 0);
@@ -147,12 +149,19 @@
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s: Failed to restore %s"),
__FUNCTION__, mods[i]);
+
+ /* try to smartly handle disappearing modules */
+ page--;
}
g_free (modfile);
}
+ /* set to the page open when gpredict was closed */
+ if (page >=0)
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (nbook), page);
+
g_strfreev (mods);
g_free (openmods);
@@ -320,6 +329,7 @@
GtkWidget *module;
gchar *mods = NULL;
gchar *buff;
+ gint page;
if (!nbook) {
@@ -362,11 +372,15 @@
__FUNCTION__, GTK_SAT_MODULE (module)->name);
}
+
+ /* store the currently open page number */
+ page = gtk_notebook_get_current_page (GTK_NOTEBOOK (nbook));
sat_log_log (SAT_LOG_LEVEL_MSG, _("%s: Saved states for %d modules."),
__FUNCTION__, num);
sat_cfg_set_str (SAT_CFG_STR_OPEN_MODULES, mods);
+ sat_cfg_set_int (SAT_CFG_INT_MODULE_CURRENT_PAGE, page);
g_free (mods);
}
Modified: trunk/src/sat-cfg.c
===================================================================
--- trunk/src/sat-cfg.c 2011-07-16 01:02:39 UTC (rev 875)
+++ trunk/src/sat-cfg.c 2011-07-24 01:17:14 UTC (rev 876)
@@ -148,6 +148,7 @@
{ "MODULES", "VIEW_1", GTK_SAT_MOD_VIEW_MAP}, /* FIXME */
{ "MODULES", "VIEW_2", GTK_SAT_MOD_VIEW_POLAR}, /* FIXME */
{ "MODULES", "VIEW_3", GTK_SAT_MOD_VIEW_SINGLE}, /* FIXME */
+ { "GLOBAL", "CURRENT_PAGE", -1}, /* FIXME */
{ "GLOBAL", "WARP", 1},
{ "MODULES", "LIST_REFRESH", 1},
{ "MODULES", "LIST_COLUMNS", LIST_COLUMNS_DEFAULTS},
Modified: trunk/src/sat-cfg.h
===================================================================
--- trunk/src/sat-cfg.h 2011-07-16 01:02:39 UTC (rev 875)
+++ trunk/src/sat-cfg.h 2011-07-24 01:17:14 UTC (rev 876)
@@ -70,6 +70,7 @@
SAT_CFG_INT_MODULE_VIEW_1, /*!< Type of view 1 */
SAT_CFG_INT_MODULE_VIEW_2, /*!< Type of view 2 */
SAT_CFG_INT_MODULE_VIEW_3, /*!< Type of view 3 */
+ SAT_CFG_INT_MODULE_CURRENT_PAGE, /*!< Number of integer parameters. */
SAT_CFG_INT_WARP_FACTOR, /*!< Time compression factor. */
SAT_CFG_INT_LIST_REFRESH, /*!< List refresh rate (cycle). */
SAT_CFG_INT_LIST_COLUMNS, /*!< List column visibility. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|