Re: gtk_combo_set_popdown_strings() coppies data?



The combo box is a widget so you destroy the combos by calling something like:

gtk_object_destroy(GTK_OBJECT(variables_combo));

Where variables_combo is the combo graphic, not the list of strings.

Clearing the GList is very simple, the GList is a pointer to the list of strings so
all you have to do is set the pointer to NULL and your GList will be empty, for
example:

if your GList is declared as something like this:

GList *variables_list_items;

Then in your code where you decide to clear the contents of the GList do the
following:

variables_list_items = NULL;


learfox furry ao net wrote:

This 3 lines will assign the same strings (variables_list_items) to 3 different
combo boxes without having to recreate the GList 2 more times. Incidently, the
list was loaded with the following routine:

   while(NEXT_LINE_AVAILABLE(TDF_GLBL->VARIABLES_LIST_FILE, temp_string))
   {
      temp_string[strlen(temp_string) - 2] = '\0';
      variables_list_items = g_list_append(variables_list_items,
g_strdup(temp_string));
   }

Then if you want to empty the contents of the combo before reloading or just for
cleaning purposes then you can simply set the GList pointer to NULL as such:

         variables_list_items = NULL;

I do this when I need to refresh the list so that we don't end up with duplicate
values or strings being appended at the end of the current GList.

Hope this is clear and it helps, if you need more help don't hesitate to ask.

Thanks for the response!

So basically I would have to record the glist, then when destroy comes
around: first deallocate the glist and each data, then set each data on
each glist item to NULL, then destroy the combo widget?

Is there a way to quickly deallocate AND set each data on a glist to NULL?

--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
..__                         ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                 http://furry.ao.net/~learfox/

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

--
Marco Quezada
Aerospaceo Engineero
NLX Corporation
22626 Sally Ride Dr.
Sterling, VA, 20164
mquezada nlxcorp com
703-234-2100 x1028
http://www.nlxcorp.com







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