/[xlog]/xlog/src/utils.c
ViewVC logotype

Diff of /xlog/src/utils.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.30 by pa4tu, Wed Nov 24 19:02:37 2004 UTC revision 1.31 by pa4tu, Thu Dec 9 13:41:55 2004 UTC
# Line 59  extern GtkWidget *b4dialog; Line 59  extern GtkWidget *b4dialog;
59  extern preferencestype preferences;  extern preferencestype preferences;
60  extern statetype state;  extern statetype state;
61  extern remotetype remote;  extern remotetype remote;
 extern gchar **bandsplit;  
 extern gchar **modesplit;  
62  extern gchar **qso;  extern gchar **qso;
63  extern gchar *xlogdir;  extern gchar *xlogdir;
64  extern gint remotetimer;  extern gint remotetimer;
# Line 100  setlocation (gdouble lat, gint NS, gdoub Line 98  setlocation (gdouble lat, gint NS, gdoub
98    
99  /* update the menu items of an optionmenu */  /* update the menu items of an optionmenu */
100  void  void
101  updateoptionmenu (GtkWidget * optionmenu, gchar **split)  makebandoptionmenu (gchar *bands)
102  {  {
103            GtkWidget *bandhbox2, *bandoptionmenu, *old;
104            gchar **split;
105          gint index = 0;          gint index = 0;
106    
107            old = g_object_get_data (G_OBJECT (mainwindow), "bandoptionmenu");
108            if (old) gtk_widget_destroy (old);
109    
110            bandoptionmenu = gtk_combo_box_new_text ();
111            gtk_widget_show (bandoptionmenu);
112            bandhbox2 = lookup_widget (mainwindow, "bandhbox2");
113            gtk_box_pack_start (GTK_BOX (bandhbox2), bandoptionmenu, TRUE, TRUE, 0);
114            gtk_widget_set_size_request (bandoptionmenu, 130, 27);
115    
116            split = g_strsplit (bands, ",", -1);
117            for (;;)
118            {
119                    if (split[index] == NULL)
120                            break;
121                    gtk_combo_box_append_text (GTK_COMBO_BOX(bandoptionmenu), split[index]);
122                    index++;
123            }
124            g_strfreev (split);
125            gtk_combo_box_set_active (GTK_COMBO_BOX (bandoptionmenu),
126                    preferences.bandoptionmenu);
127            GLADE_HOOKUP_OBJECT (mainwindow, bandoptionmenu, "bandoptionmenu");
128    }
129    
130    void
131    makemodeoptionmenu (gchar *modes)
132    {
133            GtkWidget *modehbox2, *modeoptionmenu, *old;
134            gchar **split;
135            gint index = 0;
136    
137            old = g_object_get_data (G_OBJECT (mainwindow), "modeoptionmenu");
138            if (old) gtk_widget_destroy (old);
139    
140            modeoptionmenu = gtk_combo_box_new_text ();
141            gtk_widget_show (modeoptionmenu);
142            modehbox2 = lookup_widget (mainwindow, "modehbox2");
143            gtk_box_pack_start (GTK_BOX (modehbox2), modeoptionmenu, TRUE, TRUE, 0);
144            gtk_widget_set_size_request (modeoptionmenu, 130, 27);
145    
146            split = g_strsplit (modes, ",", -1);
147          for (;;)          for (;;)
148          {          {
149                  if (split[index] == NULL)                  if (split[index] == NULL)
150                          break;                          break;
151                  gtk_combo_box_append_text (GTK_COMBO_BOX(optionmenu), split[index]);                  gtk_combo_box_append_text (GTK_COMBO_BOX(modeoptionmenu), split[index]);
152                  index++;                  index++;
153          }          }
154            g_strfreev (split);
155            gtk_combo_box_set_active (GTK_COMBO_BOX (modeoptionmenu),
156                    preferences.modeoptionmenu);
157            GLADE_HOOKUP_OBJECT (mainwindow, modeoptionmenu, "modeoptionmenu");
158  }  }
159    
160  /* removing leading and trailing whitespaces from an array of strings */  /* removing leading and trailing whitespaces from an array of strings */
# Line 240  save_windowsize_and_cleanup (void) Line 284  save_windowsize_and_cleanup (void)
284                  g_list_free (riglist);                  g_list_free (riglist);
285  #endif  #endif
286    
         g_strfreev (bandsplit);  
         g_strfreev (modesplit);  
287          g_free (xlogdir);          g_free (xlogdir);
288          if (remotetimer != -1)          if (remotetimer != -1)
289                  g_source_remove (remotetimer);                  g_source_remove (remotetimer);
# Line 435  gettime (void) Line 477  gettime (void)
477    
478  /* look up mode in a list of modes */  /* look up mode in a list of modes */
479  gchar *  gchar *
480  lookup_mode (gchar * selectedmode)  lookup_mode (gint index)
481  {  {
482          gint modeindex = 0;          gchar **s, *mode;
483    
484          for (;;)          s = g_strsplit (preferences.modes, ",", -1);
485                  {          mode = g_strdup (s[index]);
486                          if (g_ascii_strcasecmp (selectedmode, modesplit[modeindex]) == 0)          g_strfreev (s);
487          {          return (mode);
                 break;  
         }  
                         modeindex++;  
                 }  
         return (g_strdup (modesplit[modeindex]));  
488  }  }
489    
490  /* look up band in a list of bands */  /* look up band in a list of bands */
491  gchar *  gchar *
492  lookup_band (gchar * selectedband)  lookup_band (gint index)
493  {  {
494          gint bandindex = 0;          gchar **s, *band;
495    
496          for (;;)          s = g_strsplit (preferences.bands, ",", -1);
497                  {          band = g_strdup (s[index]);
498                          if (g_ascii_strcasecmp (selectedband, bandsplit[bandindex]) == 0)          g_strfreev (s);
499          {          return (band);
                 break;  
         }  
                         bandindex++;  
                 }  
         return (g_strdup (bandsplit[bandindex]));  
500  }  }
501    
502  /* clock which updates a label in the statusbar */  /* clock which updates a label in the statusbar */

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26