Re: Newbie -> About gtk_clist_find_row_from_dat...

See below for actual question.

On Wed, Oct 31, 2001 at 05:37:47PM +0100, Markus Lausser wrote:
On Mon, Oct 29, 2001 at 02:32:03AM +0100 Antonio Martínez Álvarez wrote:


I have a gtkclist list with 2 columns. When I add lines to my list, I
would like to make sure that there is not another similar line.
Well, I want the first column of my list not to have a repeated token.
I have wrote this code (I have used gtk_clist_find_row_from_data, but it
doesn't work).


The problem is here:
gtk_clist_find_row_from_data() does not compare the given string with
any text the clist displays, it only compares the _pointer_
with the pointer you have attached to the clist lines earlier (in your
case you didnt attach any data to the lines).


  // now append data to the entries:
  temp_string = g_strdup(cadensa[0]);
  clist_entries = g_list_prepend(clist_entries, temp_string);
  // then make it visible and attach data. 
  row = gtk_clist_append(clist, cadenas);

My main question is here.
What exactly gets passed to the (GtkDestroyNotify*) function?  
According to the reference manual, its a gpointer.  
  void        (*GtkDestroyNotify)             (gpointer data);

  gtk_clist_set_row_data_full(clist, row, temp_string, 
  // you have to implement the destroy_clist_data(), that frees the attached
  // data and removes the data from the clist_entries with:
  // g_free(attached_data_pointer);
  // clist_entries = g_list_remove(clist_entries, attached_data_pointer);

I want to know if its the 'data' itself that is passed, the clist widget
as a whole, just the row information?  And, if its not the row 'data' that
I attached how do i grab that data to be able to free it?

What I would like to do is just set the DestroyNotify function as
g_free() so that when the row goes away, its row data is free'd automatically.
I tried this, and it failed to produce the expected outcome.

BTW, this is for gtk 1.2.10

thanks for any insight.


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