[Gpredict-svn] SF.net SVN: gpredict:[425] trunk/src
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <cs...@us...> - 2009-09-23 20:11:25
|
Revision: 425 http://gpredict.svn.sourceforge.net/gpredict/?rev=425&view=rev Author: csete Date: 2009-09-23 20:11:17 +0000 (Wed, 23 Sep 2009) Log Message: ----------- Changed sat-activated signal to include catalog number in callback. Modified Paths: -------------- trunk/src/gtk-sat-selector.c trunk/src/mod-cfg.c Modified: trunk/src/gtk-sat-selector.c =================================================================== --- trunk/src/gtk-sat-selector.c 2009-09-23 19:55:56 UTC (rev 424) +++ trunk/src/gtk-sat-selector.c 2009-09-23 20:11:17 UTC (rev 425) @@ -130,9 +130,10 @@ G_STRUCT_OFFSET (GtkSatSelectorClass,gtksatselector), NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, - 0); + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, // return type + 1, + G_TYPE_INT); // catnum } @@ -570,10 +571,25 @@ GtkTreeViewColumn *column, gpointer data) { GtkSatSelector *selector = GTK_SAT_SELECTOR (data); + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter iter; + gboolean haveselection = FALSE; /* this flag is set to TRUE if there is a selection */ + gint catnum; /* catalog number of the selected satellite */ - /* emit the "sat-activated" signal for the GtkSatSelector */ - g_signal_emit (G_OBJECT (selector), gtksatsel_signals[SAT_ACTIVATED_SIGNAL], 0); + /* get the selected row in the treeview */ + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->tree)); + haveselection = gtk_tree_selection_get_selected (selection, &model, &iter); + if (haveselection) { + /* get the name and catalog number of the selected saetllite */ + gtk_tree_model_get (model, &iter, + GTK_SAT_SELECTOR_COL_CATNUM, &catnum, + -1); + + /* emit the "sat-activated" signal for the GtkSatSelector */ + g_signal_emit (G_OBJECT (selector), gtksatsel_signals[SAT_ACTIVATED_SIGNAL], 0, catnum); + } } Modified: trunk/src/mod-cfg.c =================================================================== --- trunk/src/mod-cfg.c 2009-09-23 19:55:56 UTC (rev 424) +++ trunk/src/mod-cfg.c 2009-09-23 20:11:17 UTC (rev 425) @@ -95,7 +95,7 @@ static void edit_advanced_settings (GtkDialog *parent, GKeyFile *cfgdata); -static void sat_activated_cb (GtkSatSelector *selector, gpointer data); +static void sat_activated_cb (GtkSatSelector *selector, gint catnr, gpointer data); /** \brief Create a new module. @@ -950,18 +950,15 @@ * This function is called when the user has selected (i.e. double clicked) a satellite * in the GtkSatSelector. */ -static void sat_activated_cb (GtkSatSelector *selector, gpointer data) +static void sat_activated_cb (GtkSatSelector *selector, gint catnr, gpointer data) { gchar *satname; gint catnum; gdouble epoch; - /*** FIXME: Change callback to include catnum into callback (for other uses */ gtk_sat_selector_get_selected (selector, &catnum, &satname, &epoch); - g_print ("===> %s (%d) updated at %.4f\n", satname, catnum, epoch); - /* Add satellite to selected list */ g_free (satname); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |