[maemo-developers] Remove list item -- How on earth?!

From: Queen queen at hol.gr
Date: Fri Oct 3 03:23:55 EEST 2008
Hello all!

So, here's the deal.
I made a GtkWidget *window5.
It has several widgets. Among them, a GtkList *list_info_description and 
a menu.

My job, at this point, is to display some text in the 
list_info_description, when the user selects a menuitem.
(for example, i select the "SOMETHING" on the menu, and some description 
about "SOMETHING" is shown in the list_info_description)

The problem is, that if i select 2 menu items, the second text appears 
right under the first, while i want the text to dissappear every time 
the user selects another menuitem.
(for example, if i select "SOMETHING", and then "SOMETHING_ELSE" on the 
menu, i want the list to display only the "SOMETHING_ELSE's" text. )

Here is a sample of a callback i have now:

void
on_mac_protocol1_activate              (GtkMenuItem     *menuitem,
                                                             
gpointer         user_data)
{
const gchar *text;
text = "MAC Protocol: Displays the MAC Protocol used.";
GtkWidget *listitem;   
GtkWidget *list_info_description;
GtkWidget *list = lookup_widget(GTK_WIDGET(window5), 
"list_info_description");
listitem = gtk_list_item_new_with_label(text);
gtk_container_add(GTK_CONTAINER(list), listitem);
gtk_widget_show(listitem);
}

As i see it, i will have to add something like 
"remove_god_damn_item(listitem);" before the "listitem = 
gtk_list_item_new_with_label(text);" command..  So that every time the 
"mac_protocol1" menuitem is activated, any remaining list items from 
previous activations will be removed, and the list will be clear and 
ready to receive the new description.

I've tried almost everything. gtk_widget_delete, gtk_widget_hide, 
gtk_container_remove, gtk_list_remove_items, gtk_list_clear,  and so on 
and so forth.
The result: My maemo project shuts down every single time, and returns 
"/usr/bin/run-standalone.sh: line 11: 10326 Segmentation fault      
(core dumped) $*
matchbox-wm: X error warning (0xc00034): BadWindow (opcode: 42) " error.

Does anybody have an idea how to clear those list items?

Btw, i'm running Maemo 2.2 Gregale

Thanx a lot, in advance!!!


More information about the maemo-developers mailing list