GSList and g_filename_from_uri free memory problem
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 problem is that when I free filename the GSList data becames corrupted, but the docs says that g_filename_from_uri returns allocated memory, so what can I do ? Once I put filename in the GSList I don't need it anymore. Is filename freed when I call g_slist_free ? -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 ); g_free (filename); len++; } The problem is that when I free filename the GSList data becames corrupted, but the docs says that g_filename_from_uri returns allocated memory, so what can I do ? Once I put filename in the GSList I don't need it anymore. 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? Is filename freed when I call g_slist_free ? You have to free it yourself before freeing the list or individual elements. GSList can store some untyped pointers. It has no idea of what they point to (or if they are real pointers at all), therefore it cannot make copies of the data, cannot free them, etc. It just stores some untyped pointers. Yeti -- That's enough. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 real pointers at all), therefore it cannot make copies of the data, cannot free them, etc. It just stores some untyped pointers. So how to solve the problem ? -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 g_print (gslist-data) I get corrupted results. filename and gslist-data are pointers to *the same* memory. When you free the memory -- it does not matter whether you do g_free(filename) or g_free(gslist-data) -- both pointers will point to the same freed memory. GSList can store some untyped pointers. It has no idea of what they point to (or if they are real pointers at all), therefore it cannot make copies of the data, cannot free them, etc. It just stores some untyped pointers. So how to solve the problem ? 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. Yeti -- That's enough. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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); len++; } The problem is that when I free filename the GSList data becames corrupted, but the docs says that g_filename_from_uri returns allocated memory, so what can I do ? Once I put filename in the GSList I don't need it anymore. Is filename freed when I call g_slist_free ? just don't fre the filenames now. Free the filenames when you free the list. Stefan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 result is exactly the same: the list contains a pointer to freed memory. Yeti -- That's enough. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 back ! -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 g_filename_from_uri and what the others nine ones ? -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Syd Logan source code
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 author or publisher of the book this question, 2. provide us the URL of the dead link, possibly with a short description what it is supposed to contain (according to the book), so that someone could possibly name a suitable substitute, even if noone else owns or knows this book, 3. utilize any of the countless other source code examples, references, fragments and programs or GTK+ tutorials that can be found at various places in the internet. Google or yahoo (or whatever) for them. If the book gives some keywords for the source samples you may even be able to locate them via search engines. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 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. So I use g_filename_from_uri to convert the filename but this function allocates memory that I must free. Since the user can drag and drop more than one file ( you noticed the while loop in the code ? ) when later I issue g_free ( filename ) only the last pointer will be freed and the others ? -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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. So I use g_filename_from_uri to convert the filename but this function allocates memory that I must free. Since the user can drag and drop more than one file ( you noticed the while loop in the code ? ) when later I issue g_free ( filename ) only the last pointer will be freed and the others ? 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); } g_slist_free(Files_to_Add); //this frees the list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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); } g_slist_free(Files_to_Add); //this frees the list Hum, what about using directly Files_to_Add instead of next_ptr ? -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 next_ptr = g_slist_next(next_ptr); } g_slist_free(Files_to_Add); //this frees the list Hum, what about using directly Files_to_Add instead of next_ptr ? 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) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 following to avoid memory leaks... array = gtk_selection_data_get_uris ( data ); /// check array != NULL len = 0 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++; } g_strfreev (array); //free the array of strings returned by .._get_uris () /// /// use the Files_to_Add list in your program /// g_slist_foreach (Files_to_Add, g_free, NULL); // free each element of the list (which is a pointer to an allocated string) g_slist_free (Files_to_Add); // free the memory occupied by the list itself I hope this helps... Regards, Santhosh. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 GSList. Long life to GTK+2 !!! -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSList and g_filename_from_uri free memory problem
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 Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: clearing gtkliststore and gtktreestore
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, Christian Neumair wrote: Am Donnerstag, den 16.02.2006, 14:18 -0500 schrieb devel: I'm having problems with clearing a treestore and a liststore. gtk_list_store_clear() and gtk_tree_store_clear() are clearing the lists visually (can see this in the GUI, obviously), but appear to be leaving copies behind and my memory is being sucked dry. I was going to try a memory leak tester to help me out, but I'm currently developing this app for windows and can't seem to find a tester for windows. I suppose you're using gtk_list_store_set (store, iter, STR_COLUMN, g_strdup (mystr), -1); Please don't dup the data yourself, GTK+ will do this for you based on the column type by calling the appropriate duplication routines. If you want to insert complex data, either use GObjects (these will be unrefed when they're removed from the model), or use plain structs and subclass G_TYPE_BOXED. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: displaying continuosly in entry widget
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 help.? In short: - NEVER use sleep() or similar in GTK+ apps - make all your handlers return as quickly as possible to GTK+ - use a timeout handler for periodic events, such as text changes In long: sleep() (or nanosleep() or similar) MUST NOT be used in any GUI program! They are of use for old style console or daemon programs only. There, your application usually is in full control of execution, scheduling of events, delays and even the entire (text) screen. GUI programs work fundamentally different. In a GUI application (a GTK+ application in our case) it is GTK+ that has full control over your application. You hand control over to GTK+ when entering gtk_main() loop. From that point on, execution of your application is basically limited to particular functions (handlers), which are called by GTK+. It's basically up to GTK+ when and in what order they are called. Your handlers may be arbitrarily complex. They my call numerous other functions, your own ones or GTK+ ones. Handlers for buttons or menu entries may even open new windows or dialogs. However, all handlers have one thing in common: they are supposed to return control to GTK+ as quickly as possible. Especially without artificial delays (like sleep () or similar)! Returning control to GTK+ means either finishing a handler function that has been called as quickly as possible, or for instance calling the GTK+ function to open modal dialogs. Graphical updates, i.e. of your text, can take place only while GTK+ is in control of program execution. The standard widgets get updated / redrawn automatically when your handler function returns to GTK+. While sleep()ing, there is no return to GTK+, but the whole process is put asleep instead. Since it's the process itself who is responsible for redrawing the widgets, there will be no redraws (and no other sign of life either) while being asleep. If you want to let your application carry out tasks on a periodic basis, i.e. changing text of a GtkEntry, you have to do it another way. You have to inform GTK+ that you want to do something every i.e. 3 seconds. You do this by calling gtk_timeout_add() or g_timeout_add(). It gets a function you provide as an argument. It informs GTK+ that this function wants to be called every 3 seconds. Then, if GTK+ is in control of program execution as it is supposed to be, it will call this function every 3 seconds, indeed. This function of yours should do nothing more than changing the text of the GtkEntry in the desired way (probably just one call to gtk_entry_set_text() ) and return to GTK+. As soon as control is returned to GTK+, the widget will be redrawn. When you don't need the periodic update any more, you just destroy your timeout handler by one of the described means. See: http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-timeout-add http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html#g-timeout-add ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkTreeView - Selecting the first row
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 first row. I thought I could do that with gtk_tree_model_get_iter_first() and gtk_tree_selection_select_iter(), but this doesn't work. Until I'm not selecting with the mouse pointer a row, I can't set a selection with gtk_tree_selection_select_iter(). Calling gtk_tree_selection_get_selected() tells me that a row is selected, but the TreeView shows nothing. Could somebody give me a hint what I'm doing wrong? Thanks, Hannes Here my piece of code: GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(treeview)); GtkTreeIter iter; gboolean is_Selection = gtk_tree_selection_get_selected(selection, model, iter); // Move selection up/down if (menu_item-index==0 || menu_item-index==1) { if (is_Selection) { GtkTreePath *path = gtk_tree_model_get_path(model, iter); if (menu_item-index==1) // down gtk_tree_path_next(path); else // up gtk_tree_path_prev(path); gtk_tree_model_get_iter(model, iter, path); } else { gtk_tree_model_get_iter_first(model, iter); } gtk_tree_selection_select_iter(selection, iter); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: OpenGL Zoom / Pan
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 scene/object to view how how you plan to view it. For example, if you are viewing an object and want to simulate a zoom in or out, one easy way is to simply have an overall scale factor that you increase or decrease and use a glScalef with the scale factor. Or another way, is to keep the scale unchanged but adjust the projection mapping as in glOrtho(). To zoom in, you decrease the size of the x and y bounds of the viewing volume according to your scale factor. On Wed, 2006-02-22 at 19:28 +0100, Philippe CHAUVAT wrote: A little bit out of the list themas... but I wrote some program with gtkglext and would like to do some Zoom, Pan, Rotate things with mouse and/or keyboard. Does anyone know where to find some sample or tutorial about this ? Thanks in advance. Philippe ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GTK2: no images are displayed
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 work. When I have a look at the delivered GError I get an error of the domain GDK_PIXBUF_ERROR, Code 3 (which means GDK_PIXBUF_ERROR_UNKNOWN_TYPE). It absolutely doesn't matter what kind of Image I try to load (jpg, bmp, xpm, tif). It never works. I think, I also have installed all necessary libs. Other GTK-based programs (e. g. the gimp) work fine on this computer. If anyone has a hint or an idea, I'd be very happy! Thanks in advance, netnobbi -- Telefonieren Sie schon oder sparen Sie noch? NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Fatal IO error 105 - Help
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: Fatal IO error 105 ( No buffer space availabel ) on X server : 0.0 The program fills up an array of unsigned char and I then call gdk_draw_rgb_image() in the expose event callback everytime a new image is present. I'm at odds to be honest, everything I found on the internet refers to the use of TCP/IP or FTP which i'm not using at all. ** The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. ** ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Gtkhtml: how to append to the page without reloading the content
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 can look at scroll with the first few items... Is there a way to do this? Thanks in advance, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: Syd Logan source code
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 Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gus Koppel Sent: Thursday, February 23, 2006 1:58 AM To: gtk-app-devel-list@gnome.org Subject: Re: Syd Logan source code 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 author or publisher of the book this question, 2. provide us the URL of the dead link, possibly with a short description what it is supposed to contain (according to the book), so that someone could possibly name a suitable substitute, even if noone else owns or knows this book, 3. utilize any of the countless other source code examples, references, fragments and programs or GTK+ tutorials that can be found at various places in the internet. Google or yahoo (or whatever) for them. If the book gives some keywords for the source samples you may even be able to locate them via search engines. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkTreeView - Selecting the first row
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 found out, that the problem is the focus of the widget. When my app starts, another widget seems to have the focus and pressing tab or a cursor key moves the focus to the TreeView and the selection works. So, my new questions is: How can I set the focus on the TreeView? gtk_widget_grab_focus(treeview) doesn't work. Hannes Mayr wrote: 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 first row. I thought I could do that with gtk_tree_model_get_iter_first() and gtk_tree_selection_select_iter(), but this doesn't work. Until I'm not selecting with the mouse pointer a row, I can't set a selection with gtk_tree_selection_select_iter(). Calling gtk_tree_selection_get_selected() tells me that a row is selected, but the TreeView shows nothing. Could somebody give me a hint what I'm doing wrong? Thanks, Hannes Here my piece of code: GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(treeview)); GtkTreeIter iter; gboolean is_Selection = gtk_tree_selection_get_selected(selection, model, iter); // Move selection up/down if (menu_item-index==0 || menu_item-index==1) { if (is_Selection) { GtkTreePath *path = gtk_tree_model_get_path(model, iter); if (menu_item-index==1) // down gtk_tree_path_next(path); else // up gtk_tree_path_prev(path); gtk_tree_model_get_iter(model, iter, path); } else { gtk_tree_model_get_iter_first(model, iter); } gtk_tree_selection_select_iter(selection, iter); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- INDUNET GmbH/Srl - Trientstr. 36c - I-39040 Salurn Tel: +39 0471 883650 - Fax: +39 0471 883648 www.indunet.it - [EMAIL PROTECTED] - [EMAIL PROTECTED] INFORMAZIONI STRETTAMENTE CONFIDENZIALI Il presente messaggio e relativi allegati, contengono informazioni strettamente riservate e destinate esclusivamente al destinatario sopra indicato, il quale è l'unico autorizzato ad usarli, copiarli e, sotto la propria responsabilità, diffonderli. Chiunque ricevesse questo messaggio per errore o comunque lo leggesse senza esserne legittimato è avvertito che - in base alle disposizioni del D. Lgs 196/2003 - trattenerlo, copiarlo, divulgarlo, distribuirlo a persone diverse dal destinatario è severamente proibito ed è pregato di inviarlo immediatamente al mittente distruggendo l'originale. Indunet Srl è in possesso di questo indirizzo email ottenuto per comunicazione diretta dell' interessato a Indunet Srl o a suoi collaboratori oppure da avvisi, siti internet e altri documenti pubblici. Non siamo in possesso di altri dati che riguardano l'intestatario dell'email salvo quanto comunicato dall'interessato, e l'inizio di un rapporto di tipo commerciale è subordinato all'invio della nostra informativa al trattamento dei dati personali e all' accettazione da parte dell' interessato. Tali dati verranno conservati fino a che i servizi e i prodotti offerti da Indunet Srl non saranno più necessari o graditi. Grazie. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK2: no images are displayed
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. But also if I put it directly in a box on the mainwidget this makes no difference. Hope anyone can help... netnobbi On Thu, 23 Feb 2006 09:55:27 -0500, Gravis Zero wrote: not to be unhelpful or anything but have you made a very basic demo? if it still doesnt work, please post it on something like pastebin.com also, what kind of widget are you using to display the pixbuf? is it a GtkImage? Gravis On Thu, 2006-02-23 at 15:31 +0100, Norbert Bauer wrote: 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 work. When I have a look at the delivered GError I get an error of the domain GDK_PIXBUF_ERROR, Code 3 (which means GDK_PIXBUF_ERROR_UNKNOWN_TYPE). It absolutely doesn't matter what kind of Image I try to load (jpg, bmp, xpm, tif). It never works. I think, I also have installed all necessary libs. Other GTK-based programs (e. g. the gimp) work fine on this computer. If anyone has a hint or an idea, I'd be very happy! Thanks in advance, netnobbi -- DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert: GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Changing font size and color
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 - What are the most popular cars? Find out at Yahoo! Autos ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Application structuring with threads network I/O - suggestions?
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. [...] Unfortunately, we can't do much about it without having seen code. My suspicion is that you just proved that C is error prone. um .. actually, it's not. Without getting into a major relegious war, NO language is error prone - *programmers* are error prone. A bad programmer will write bad code. A good programmer will write good code. A great programmer will write code that makes you all wet squishy :-) Anyway - that's besides the point. I've solved the problem, and it seems to have been an interaction between the gnet library I was trying to use and gtk. While searching the web for problems similar to the ones I was having, I came across a bug report/discussion thread somewhere that described almost exactly the problems I was having. I'm sorry I don't remember the details, or remembered to save the links. Tor was part of the discussion, and the big problem was that he was unable to reproduce the bug on your systems, so there wasn't a lot you could have done about it. So I bit the bullet, and went under the hood of windows. It was much less painfull that I thought it would be - I didn't realise that the windows networking stacks were based on the BSD stacks, so it didn't take me long to replace the gnet calls with the native windows API. Inside of 2 hours I had a fully working application. Given that the only code changes *were* in my network routines, I'm pretty sure that there is something weird happening between the 2.8 series of Tor's port and the gnet libary. Tor: I'm sorry I don't still have that code - it might have helped you reproduce something, but I wasn't thinking about that at the time. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Drag from a KDE window and drop to GTK one
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 manager - http://xarchiver.sourceforge.net Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list