GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
Hi, I have this code: gchar **array = NULL;: array = gtk_selection_data_get_uris ( data ); while (array[len]) { filename = g_filename_from_uri ( array[len] , NULL, NULL ); Files_to_Add = g_slist_prepend ( Files_to_Add , filename ); g_free (filename); len++; } The

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread David Necas (Yeti)
On Thu, Feb 23, 2006 at 09:22:30AM +0100, Colossus wrote: gchar **array = NULL;: array = gtk_selection_data_get_uris ( data ); while (array[len]) { filename = g_filename_from_uri ( array[len] , NULL, NULL ); Files_to_Add = g_slist_prepend ( Files_to_Add , filename );

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
David Necas (Yeti) wrote: You have to free it yourself before freeing the list or individual elements. I did it with g_free (filename) but when I use g_print (gslist-data) I get corrupted results. GSList can store some untyped pointers. It has no idea of what they point to (or if they are

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread David Necas (Yeti)
On Thu, Feb 23, 2006 at 09:46:14AM +0100, Colossus wrote: David Necas (Yeti) wrote: You have to free it yourself before freeing the list or ^^ individual elements. ^^^ I did it with g_free (filename) but when I use

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Stefan Kost
Hi Colossus wrote: Hi, I have this code: gchar **array = NULL;: array = gtk_selection_data_get_uris ( data ); while (array[len]) { filename = g_filename_from_uri ( array[len] , NULL, NULL ); Files_to_Add = g_slist_prepend ( Files_to_Add , filename ); g_free (filename);

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread David Necas (Yeti)
On Thu, Feb 23, 2006 at 10:19:36AM +0100, Colossus wrote: I don't have to store pointers to freed memory but the filename without file:// and escaped sequences that g_filename_from_uri gives me back ! It does not matter whether you free the memory before or after g_slist_prepend(). The

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
David Necas (Yeti) wrote: I suppose you do need something when you store it to a GSList. What is the point of storing pointers to freed memory to a GSList? I don't have to store pointers to freed memory but the filename without file:// and escaped sequences that g_filename_from_uri gives me

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
Stefan Kost wrote: just don't fre the filenames now. Free the filenames when you free the list. Ok, but you see the while loop ? if the user drags 10 files from Nautilis window inside Xarchiver ( my app ) window, when I issue g_free later I will only free the last pointer gave me back from

Re: Syd Logan source code

2006-02-23 Thread Gus Koppel
Nimmo, William K @ TITAN wrote: I apologize if this has been addressed previously. I have bought Syd Logan's book GTK+ Programming in C. The link referenced in the book to obtain sample code is a dead link. Does anybody know where I can get the sample code? You should either 1. ask the

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
David Necas (Yeti) wrote: Since the problem seems to be an incorrect assumption of how GSList works and I cannot describe how it actually works more clearly than above, then either by letting someone with better English skills to explain it or by you trying harder to understand me. Ok, I

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Gaurav Jain
Ok, I understood the matter. Let me explain my problem now: I'm adding drag and drop to my app. To retrieve the content of the selection dropped into the window of my app I use gtk_selection_data_get_uris. The problem is that I get the filename like this: file:///home/gt/GTA%20 and so on.

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
Gaurav Jain wrote: All your filenames can be retrieved and freed by looping through the list: Something like: GSList *next_ptr = Files_to_Add; while (next_ptr != NULL) { g_free(next_ptr-data); //this frees the filenames next_ptr = g_slist_next(next_ptr); }

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Gaurav Jain
On 2/23/06, Colossus [EMAIL PROTECTED] wrote: Gaurav Jain wrote: All your filenames can be retrieved and freed by looping through the list: Something like: GSList *next_ptr = Files_to_Add; while (next_ptr != NULL) { g_free(next_ptr-data); //this frees the filenames

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Santhosh
gchar **array = NULL;: array = gtk_selection_data_get_uris ( data ); while (array[len]) { filename = g_filename_from_uri ( array[len] , NULL, NULL ); Files_to_Add = g_slist_prepend ( Files_to_Add , filename ); g_free (filename); len++; } You can do the

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
Gaurav Jain wrote: you must pass the list's head node pointer to g_slist_free(), which you will lost if you use Files_to_Add directly (in fact, it will always be null after the while loop) Thank you all, I discovered a memory leak in my code. I was not freeing the data pointer inside the

Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Colossus
Santhosh wrote: I hope this helps... Surely it helps, this way I can free all the pointers in one shot without iterating through the GSList with the while loop. Thank you so much Santosh !! -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net

Re: clearing gtkliststore and gtktreestore

2006-02-23 Thread kadil
I have had problems in this area as well. Using gtk# mono, if I use gtk_tree_store_clear, then I cannot add more rows. I haven't really looked into it yet. I just removed rows one at a time until they are all gone. Not nice, but it will do for now. Kim On Wed, 2006-02-22 at 17:07 +0100,

Re: displaying continuosly in entry widget

2006-02-23 Thread Gus Koppel
shibu alampatta wrote: On pressing a button i wanted a list of text to be displayed on entry widget, on after the other ( in a for loop), with some delay, say sleep(3). but the problem is the last text only getting visible. if i increase the sleep argument then also the same. any

GtkTreeView - Selecting the first row

2006-02-23 Thread Hannes Mayr
Hello, I'm having a problem with the selection on a TreeView widget. I have a simple Treeview with one visible column and want to move the selection up and down with 2 buttons. When my application starts there is no row selected, so clicking on a button I need to set the selection to the

Re: OpenGL Zoom / Pan

2006-02-23 Thread Philippe CHAUVAT
Thank you Douglas. I'm going to have a look of this example and then try it. Philippe Douglas Vechinski a écrit : Try taking a look at the shapes.c example that comes with the gtkglext package. There are different ways do to them and it sort of depends upon how you plan on setting up the

GTK2: no images are displayed

2006-02-23 Thread Norbert Bauer
Hi! I'm using (the first time) GTK2 to build a GUI application under windows. Up to now everything worked fine. But now I have a problem: Im using the function gdk_pixbuf_new_from_file to generate a gdk-pixbuf. The program compiles and runs, but no images are displayed. It simply doesn't

Fatal IO error 105 - Help

2006-02-23 Thread Noonan, Michael (DCOI)
Hello Everybody, I have a GUI application that displays an RGB image whenever it receives a message from a seperate process. This is usually a couple of images of images per second. However when I let the program run continously for long periods of time( an hour + ) I receive the error:

Gtkhtml: how to append to the page without reloading the content

2006-02-23 Thread Van H Tran
Hi, I'm using gtkhtml library to display a list of items in a webpage. One possible way is to parse the whole page before displaying it but it will keep users waiting. I want to display some items, and then append it to the page, without reloading the content, _just_appending_, so that users

RE: Syd Logan source code

2006-02-23 Thread Nimmo, William K @ TITAN
Someone on this forum pointed me to Syd Logans personal web page, where I was able to download the source code from the book. For those interested, the link is: http://www.sydlogan.com/index2.html The dead link that the book references is: www.cts.com/crash/s/slogan/gtkbook.html -Original

Re: GtkTreeView - Selecting the first row

2006-02-23 Thread Hannes Mayr
Stefan Kost wrote: hi, just a wild guess, are use using the GTK_SELECTION_BROWSE selection mode? GtkTreeSelection *select; select = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree)); gtk_tree_selection_set_mode (select, GTK_SELECTION_BROWSE); Yes, I already tried that without success. I've

Re: GTK2: no images are displayed

2006-02-23 Thread Norbert Bauer
Thank you for your hint! Yes, I made a very basic programm. I posted an extract of my code to: http://pastebin.com/568620 The commented block of 5 lines in the code was used to find out more about the problem and is not really part of the code. In this code, the image ist to be put on a button.

Changing font size and color

2006-02-23 Thread Sandeep KS
Hi everyone, I want to increase the font size and also change the font color in GTK. So can anyone please tell me how to do it? Also tell me if i can change the background color of the GtkWindow. Thanking You Sandeep Regards

Re: Application structuring with threads network I/O - suggestions?

2006-02-23 Thread Gorshkov
On Wednesday 22 February 2006 11:02, Christian Neumair wrote: Am Freitag, den 17.02.2006, 22:04 -0500 schrieb Gorshkov: I'm developing an small network application as a test case before I go on to my main app - I want to make my mistakes on something small manageable. [...]

Drag from a KDE window and drop to GTK one

2006-02-23 Thread Colossus
Hi, I'm coding drag and drop feature to my app, Xarchiver, I was wondering if the drag from a Konqueror (KDE) window and drop to the GTK window of my app will work. Is there some GTK additional call to perform to have the above work ? Thanks, -- Colossus Xarchiver, a Linux GTK+2 only archive