[Gpredict-svn] SF.net SVN: gpredict:[74] trunk/src
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2008-08-27 21:12:29
|
Revision: 74
http://gpredict.svn.sourceforge.net/gpredict/?rev=74&view=rev
Author: csete
Date: 2008-08-27 21:12:37 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
Added field for port number.
Modified Paths:
--------------
trunk/src/sat-pref-rot-data.h
trunk/src/sat-pref-rot-editor.c
trunk/src/sat-pref-rot.c
Modified: trunk/src/sat-pref-rot-data.h
===================================================================
--- trunk/src/sat-pref-rot-data.h 2008-08-27 21:10:00 UTC (rev 73)
+++ trunk/src/sat-pref-rot-data.h 2008-08-27 21:12:37 UTC (rev 74)
@@ -32,6 +32,7 @@
typedef enum {
ROT_LIST_COL_NAME = 0, /*!< File name. */
ROT_LIST_COL_HOST, /*!< Hostname */
+ ROT_LIST_COL_PORT, /*!< Port number */
ROT_LIST_COL_MINAZ, /*!< Lower Az limit. */
ROT_LIST_COL_MAXAZ, /*!< Upper Az limit. */
ROT_LIST_COL_MINEL, /*!< Lower El limit. */
Modified: trunk/src/sat-pref-rot-editor.c
===================================================================
--- trunk/src/sat-pref-rot-editor.c 2008-08-27 21:10:00 UTC (rev 73)
+++ trunk/src/sat-pref-rot-editor.c 2008-08-27 21:12:37 UTC (rev 74)
@@ -52,7 +52,8 @@
/* private widgets */
static GtkWidget *dialog; /* dialog window */
static GtkWidget *name; /* Configuration name */
-static GtkWidget *host; /* rotor model, e.g. TS-2000 */
+static GtkWidget *host; /* host name or IP */
+static GtkWidget *port; /* port number */
static GtkWidget *minaz;
static GtkWidget *maxaz;
static GtkWidget *minel;
@@ -142,7 +143,7 @@
GtkWidget *label;
- table = gtk_table_new (4, 4, FALSE);
+ table = gtk_table_new (5, 4, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
@@ -175,42 +176,54 @@
_("Enter the host and port where rogctld is running, e.g. 192.168.1.100:15123"));
gtk_table_attach_defaults (GTK_TABLE (table), host, 1, 4, 1, 2);
+ /* port */
+ label = gtk_label_new (_("Port"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
+
+ port = gtk_spin_button_new_with_range (1024, 65535, 1);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (port), 4533);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON (port), 0);
+ gtk_widget_set_tooltip_text (port,
+ _("Enter the port number where rotctld is listening"));
+ gtk_table_attach_defaults (GTK_TABLE (table), port, 1, 3, 2, 3);
+
/* Az and El limits */
label = gtk_label_new (_(" Min Az"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
minaz = gtk_spin_button_new_with_range (-40, 450, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (minaz), 0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (minaz), TRUE);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (minaz), FALSE);
- gtk_table_attach_defaults (GTK_TABLE (table), minaz, 1, 2, 2, 3);
+ gtk_table_attach_defaults (GTK_TABLE (table), minaz, 1, 2, 3, 4);
label = gtk_label_new (_(" Max Az"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 2, 3);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 3, 4);
maxaz = gtk_spin_button_new_with_range (-40, 450, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (maxaz), 360);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (maxaz), TRUE);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (maxaz), FALSE);
- gtk_table_attach_defaults (GTK_TABLE (table), maxaz, 3, 4, 2, 3);
+ gtk_table_attach_defaults (GTK_TABLE (table), maxaz, 3, 4, 3, 4);
label = gtk_label_new (_(" Min El"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5);
minel = gtk_spin_button_new_with_range (-10, 180, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (minel), 0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (minel), TRUE);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (minel), FALSE);
- gtk_table_attach_defaults (GTK_TABLE (table), minel, 1, 2, 3, 4);
+ gtk_table_attach_defaults (GTK_TABLE (table), minel, 1, 2, 4, 5);
label = gtk_label_new (_(" Max El"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 3, 4);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 4, 5);
maxel = gtk_spin_button_new_with_range (-10, 180, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (maxel), 90);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (maxel), TRUE);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (maxel), FALSE);
- gtk_table_attach_defaults (GTK_TABLE (table), maxel, 3, 4, 3, 4);
+ gtk_table_attach_defaults (GTK_TABLE (table), maxel, 3, 4, 4, 5);
if (conf->name != NULL)
update_widgets (conf);
@@ -234,6 +247,12 @@
if (conf->host)
gtk_entry_set_text (GTK_ENTRY (host), conf->host);
+ /* port */
+ if (conf->port > 1023)
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (port), conf->port);
+ else
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (port), 4533); /* hamlib default? */
+
/* az and el limits */
gtk_spin_button_set_value (GTK_SPIN_BUTTON (minaz), conf->minaz);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (maxaz), conf->maxaz);
@@ -255,6 +274,7 @@
{
gtk_entry_set_text (GTK_ENTRY (name), "");
gtk_entry_set_text (GTK_ENTRY (host), "");
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (port), 4533); /* hamlib default? */
gtk_spin_button_set_value (GTK_SPIN_BUTTON (minaz), 0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (maxaz), 360);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (minel), 0);
@@ -284,6 +304,9 @@
conf->host = g_strdup (gtk_entry_get_text (GTK_ENTRY (host)));
+ /* port */
+ conf->port = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (port));
+
/* az and el ranges */
conf->minaz = gtk_spin_button_get_value (GTK_SPIN_BUTTON (minaz));
conf->maxaz = gtk_spin_button_get_value (GTK_SPIN_BUTTON (maxaz));
Modified: trunk/src/sat-pref-rot.c
===================================================================
--- trunk/src/sat-pref-rot.c 2008-08-27 21:10:00 UTC (rev 73)
+++ trunk/src/sat-pref-rot.c 2008-08-27 21:12:37 UTC (rev 74)
@@ -55,11 +55,6 @@
static void edit_cb (GtkWidget *button, gpointer data);
static void delete_cb (GtkWidget *button, gpointer data);
-static void render_rot_type (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column);
static void render_angle (GtkTreeViewColumn *col,
GtkCellRenderer *renderer,
GtkTreeModel *model,
@@ -125,7 +120,13 @@
NULL);
gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);
-
+ /* port */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("Port"), renderer,
+ "text", ROT_LIST_COL_PORT,
+ NULL);
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);
+
/* Az and el limits */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Min Az"), renderer,
@@ -186,10 +187,11 @@
liststore = gtk_list_store_new (ROT_LIST_COL_NUM,
G_TYPE_STRING, // name
G_TYPE_STRING, // host
- G_TYPE_INT, // Min Az
- G_TYPE_INT, // Max Az
- G_TYPE_INT, // Min El
- G_TYPE_INT // Max El
+ G_TYPE_INT, // port
+ G_TYPE_DOUBLE, // Min Az
+ G_TYPE_DOUBLE, // Max Az
+ G_TYPE_DOUBLE, // Min El
+ G_TYPE_DOUBLE // Max El
);
/* open configuration directory */
@@ -214,6 +216,7 @@
gtk_list_store_set (liststore, &item,
ROT_LIST_COL_NAME, conf.name,
ROT_LIST_COL_HOST, conf.host,
+ ROT_LIST_COL_PORT, conf.port,
ROT_LIST_COL_MINAZ, conf.minaz,
ROT_LIST_COL_MAXAZ, conf.maxaz,
ROT_LIST_COL_MINEL, conf.minel,
@@ -324,6 +327,7 @@
rotor_conf_t conf = {
.name = NULL,
.host = NULL,
+ .port = 4533,
.minaz = 0,
.maxaz = 360,
.minel = 0,
@@ -366,6 +370,7 @@
gtk_tree_model_get (model, &iter,
ROT_LIST_COL_NAME, &conf.name,
ROT_LIST_COL_HOST, &conf.host,
+ ROT_LIST_COL_PORT, &conf.port,
ROT_LIST_COL_MINAZ, &conf.minaz,
ROT_LIST_COL_MAXAZ, &conf.maxaz,
ROT_LIST_COL_MINEL, &conf.minel,
@@ -405,6 +410,7 @@
rotor_conf_t conf = {
.name = NULL,
.host = NULL,
+ .port = 4533,
.minaz = 0,
.maxaz = 360,
.minel = 0,
@@ -421,6 +427,7 @@
gtk_list_store_set (liststore, &item,
ROT_LIST_COL_NAME, conf.name,
ROT_LIST_COL_HOST, conf.host,
+ ROT_LIST_COL_PORT, conf.port,
ROT_LIST_COL_MINAZ, conf.minaz,
ROT_LIST_COL_MAXAZ, conf.maxaz,
ROT_LIST_COL_MINEL, conf.minel,
@@ -453,6 +460,7 @@
rotor_conf_t conf = {
.name = NULL,
.host = NULL,
+ .port = 4533,
.minaz = 0,
.maxaz = 360,
.minel = 0,
@@ -480,6 +488,7 @@
gtk_tree_model_get (model, &iter,
ROT_LIST_COL_NAME, &conf.name,
ROT_LIST_COL_HOST, &conf.host,
+ ROT_LIST_COL_PORT, &conf.port,
ROT_LIST_COL_MINAZ, &conf.minaz,
ROT_LIST_COL_MAXAZ, &conf.maxaz,
ROT_LIST_COL_MINEL, &conf.minel,
@@ -510,6 +519,7 @@
gtk_list_store_set (GTK_LIST_STORE(model), &iter,
ROT_LIST_COL_NAME, conf.name,
ROT_LIST_COL_HOST, conf.host,
+ ROT_LIST_COL_PORT, conf.port,
ROT_LIST_COL_MINAZ, conf.minaz,
ROT_LIST_COL_MAXAZ, conf.maxaz,
ROT_LIST_COL_MINEL, conf.minel,
@@ -587,13 +597,13 @@
GtkTreeIter *iter,
gpointer column)
{
- gint number;
+ gdouble number;
guint coli = GPOINTER_TO_UINT (column);
gchar *text;
gtk_tree_model_get (model, iter, coli, &number, -1);
- text = g_strdup_printf ("%d\302\260", number);
+ text = g_strdup_printf ("%.0f\302\260", number);
g_object_set (renderer, "text", text, NULL);
g_free (text);
}
@@ -601,52 +611,5 @@
-/** \brief Render rotator type.
- * \param col Pointer to the tree view column.
- * \param renderer Pointer to the renderer.
- * \param model Pointer to the tree model.
- * \param iter Pointer to the tree iterator.
- * \param column The column number in the model.
- *
- * This function renders the rotator type onto the rotator list.
- * The rotator type is stored as enum; however, we want to display it
- * using some escriptive text, e.g. "AZ", "EL", and so on
- */
-static void render_rot_type (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
-{
- guint number;
- guint coli = GPOINTER_TO_UINT (column);
-
- gtk_tree_model_get (model, iter, coli, &number, -1);
-/* switch (number) {
- case ROTOR_TYPE_AZ:
- g_object_set (renderer, "text", "AZ", NULL);
- break;
-
- case ROTOR_TYPE_EL:
- g_object_set (renderer, "text", "EL", NULL);
- break;
-
- case ROTOR_TYPE_AZEL:
- g_object_set (renderer, "text", "AZ/EL", NULL);
- break;
-
- default:
- sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s:%s: Invalid type: %d. Using AZ."),
- __FILE__, __FUNCTION__, number);
- g_object_set (renderer, "text", "AZ", NULL);
- break;
-
- }*/
-
-}
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|