[Glade-users] gtk_combo_get_text problem



I am trying to read the text from a combo_entry.  For some reason, after the
first time I select, I get multiple responses.  Specifically, I get a blank
response, then my selection.    Here is my code snippet:

on_entry_oi_changed                    (GtkEditable     *editable,
                                        gpointer         user_data)
{
 GtkWidget * combo = lookup_widget(GTK_WIDGET(editable), "combo_oi");

 gchar * text;

 text = strdup(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)));

 if (text == ">>")
    printf ("Add User.\n");
 else
   {
   printf("Initials --|  %s  |-- were selected\n", text);

   GtkWidget * temp = lookup_widget(GTK_WIDGET(editable), "vb_area");
   gtk_widget_set_sensitive(temp, TRUE);
   temp = lookup_widget(GTK_WIDGET(editable), "vbox_data2");
   gtk_widget_set_sensitive(temp, TRUE);
   temp = lookup_widget(GTK_WIDGET(editable), "vbox_data3");
   gtk_widget_set_sensitive(temp, TRUE);
   temp = lookup_widget(GTK_WIDGET(editable), "menu_items");
   gtk_widget_set_sensitive(temp, TRUE);
   temp = lookup_widget(GTK_WIDGET(editable), "btn_apply");
   gtk_widget_set_sensitive(temp, TRUE);
   temp = lookup_widget(GTK_WIDGET(editable), "btn_clear");
   gtk_widget_set_sensitive(temp, TRUE);
   }/*else*/
}
  The comb_list is a blank line, >>, WR, CP, OC, CI, <<.  (The >> and << are
for adding or removing initials from the list.)
When run, a slew of widgets are disabled--the user must first enter their
initials from a list.  After the first selection, the program correctly
prints the entry text, and enables the widgets.  For some reason, subsequent
selections will output two lines:  "Initials --|    |-- were selected."  and
another line with the text inside the --| |-- area.  What am I doing wrong?
Do I need to reset "text" somehow, should I use a different signal, or am I
simply missing some basic programming here?

Thanks.

Andy





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]