Stateful button widgets in non-main windows

2013-12-15 Thread David Buchan
I had an interesting (to me, anyway) situation: I have a program which, if a user presses a button, opens a new window containing various text entries, textviews, and radiobuttons. The new window also contained a checkbutton. The state of the radiobuttons and checkbutton were stored in flags

Re: Still confused on new thread starting idle functions to update UI.

2013-12-04 Thread David Buchan
On Tue, 3 Dec 2013 19:59:22 -0800 (PST) David Buchan pdbuc...@yahoo.com wrote: ok, I may be getting somewhere. I did some reading on heap memory versus stack. Here's a vastly simplified example program which doesn't use GTK+, but I'm using to demonstrate my plan of attack. I use

Re: Still confused on new thread starting idle functions to update UI.

2013-12-04 Thread David Buchan
On 4 December 2013 13:31,  jcup...@gmail.com wrote: Here's a tiny, complete program that does almost what you want. It's gtk2, but should work fine with gtk3. http://pastebin.com/PsG2UDkY It just updates a status bar, but it'd be easy to make it do a textview instead. John

Re: Still confused on new thread starting idle functions to update UI.

2013-12-04 Thread David Buchan
On Wed, Dec 4, 2013 at 2:59 PM, David Buchan pdbuc...@yahoo.com wrote:   // Allocate memory on the heap, not stack.   msgdata = (msgdatas *) malloc (1 * sizeof (msgdatas));   msgdata-textview = (int *) malloc (1 * sizeof (int));   message = (char *) malloc (1024); The only blocks of memory

Re: Still confused on new thread starting idle functions to update UI.

2013-12-04 Thread David Buchan
On Thu, Dec 5, 2013 at 2:00 AM, David Buchan pdbuc...@yahoo.com wrote: Things I've learned yesterday are: 1. strdup() (I've never seen or used it before) 2. what the heck heap and stack mean (still more to learn there) 3. a more general and flexible solution is probably to use asynchronous

Still confused on new thread starting idle functions to update UI.

2013-12-03 Thread David Buchan
These darn threads and idle functions still baffle me. I'm sorry to be such a pest. I want to periodically update a textview as new information comes available. Sometimes this information can come in quickly (roughly every tenth of a second). Each update is a single line of text. The observed

Re: Still confused on new thread starting idle functions to update UI.

2013-12-03 Thread David Buchan
David Buchan pdbuc...@yahoo.com wrote: These darn threads and idle functions still baffle me. I'm sorry to be such a pest. I want to periodically update a textview as new information comes available. Sometimes this information can come in quickly (roughly every tenth of a second

Re: Still confused on new thread starting idle functions to update UI.

2013-12-03 Thread David Buchan
David Buchan pdbuc...@yahoo.com wrote: [snip] It is awkward, and probably unnecessary.  Unless you have a very good reason, that is not the way to do it.  Pass the idle function a string allocated on the heap, and free it in the idle function when finished with.  Any other way creates thread

Re: Still confused on new thread starting idle functions to update UI.

2013-12-03 Thread David Buchan
ok, I may be getting somewhere. I did some reading on heap memory versus stack. Here's a vastly simplified example program which doesn't use GTK+, but I'm using to demonstrate my plan of attack. I use a function called packit() which allows me to still use strdup(). Comments? Dave Valgrind

Re: Delay time to spawn new threads?

2013-11-28 Thread David Buchan
On Wed, 27 Nov 2013 19:32:26 -0800 (PST) David Buchan pdbuc...@yahoo.com wrote: I removed the call to g_thread_init() and it still works fine! Great catch there. You can include it with glib = 2.32 - it is a no-op then.  You should include it if you want your code to be able to run on earlier

Re: Delay time to spawn new threads?

2013-11-27 Thread David Buchan
Hi Andrew, Yes, I've tried the printf thing. It takes about 1.5 sec. Very strange. Dave From: Andrew Potter agpot...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Wednesday, November 27, 2013

Re: Delay time to spawn new threads?

2013-11-27 Thread David Buchan
:29 AM, David Buchan wrote: I have written a program which spawns a new thread when the user clicks a button. The new thread does something noticeable immediately after starting, so I know when the thread has begun. What I mean is, if I run that piece of code that is executed as a new thread

Re: Delay time to spawn new threads?

2013-11-27 Thread David Buchan
David Buchan pdbuc...@yahoo.com wrote: Hi Michael, My 32-bit, GTK+2 version does   // Secure glib   if (!g_thread_supported ()) {     g_thread_init (NULL);   } at the beginning, and then the thread is spawned via: on_button1_clicked (GtkButton *button1, MyData *data

Re: Delay time to spawn new threads?

2013-11-27 Thread David Buchan
David Buchan pdbuc...@yahoo.com wrote: Hi Michael, My 32-bit, GTK+2 version does   // Secure glib   if (!g_thread_supported ()) {     g_thread_init (NULL);   } at the beginning, and then the thread is spawned via: on_button1_clicked (GtkButton *button1, MyData *data

Valgrind is grinding my gears

2013-11-05 Thread David Buchan
I have a rather large program I've written in C language which uses GTK+2. My Makefile has: CCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0` LIBS    = `pkg-config --libs   gtk+-2.0 gmodule-2.0` GCC compiles it without warnings using flags: -Wall -O -Wuninitialized My program has several

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
trouble with g-sliced memory? From: David Buchan pdbuc...@yahoo.com To: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 12:47 PM Subject: Valgrind is grinding my gears I have a rather large program I've written in C language

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
when freeing - https://developer.gnome.org/glib/unstable/glib-Memory-Slices.html I do indeed change dimensions of arrays declared within my struct (a lot, in fact). Could this be the cause? From: David Buchan pdbuc...@yahoo.com To: gtk-app-devel-list list gtk-app

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
essentially what using G_SLICE=always-malloc would do. I can't try this out until late tonight, unfortunately. From: David Nečas y...@physics.muni.cz To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
Aaaah. I see. Thanks guys. From: Bernhard Schuster schuster.bernh...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: David Nečas y...@physics.muni.cz; gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 3:59 PM Subject

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
Great! Thanks! Dave From: jcup...@gmail.com jcup...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 4:56 PM Subject: Re: Valgrind is grinding my gears I have

Re: Can I install both GTK+2 and GTK+3?

2013-05-17 Thread David Buchan
might be able to build GTK+3, but that's likely a lot of work. So had in mind producing two binaries for the distribution tarball. From: Emmanuele Bassi eba...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org

Can I install both GTK+2 and GTK+3?

2013-05-16 Thread David Buchan
I am using Ubuntu 13.04. Rumour on the street (I *think* I read it somewhere) is that I can install both libgtk2.0-dev and libgtk-3-dev. Is that true? Can they both be installed without interfering with each other, and without breaking Unity? I'd like to be able to provide executables of my

GTK tables

2013-01-27 Thread David Buchan
I've created a table with Glade and put various widgets in some of the cells. Ifin one particular rowI have: a label,a text entry, and finally a few cells that I don't need to put anything into, should I place blank labels in those last unused cells, or just leave them unspecified? Would there

Clarification on recent deprecations

2012-10-24 Thread David Buchan
Based on recent discussion on threads/idles/timeouts, I wonder if I could get confirmation that what I'm doing to remove deprecated stuff is correct. Current Situation: Ubuntu 10.04 libgtk2.0-dev 3.7.0.is.3.6.7-0ubuntu1 Makefile contains: CCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0`

GTK window positioning

2012-09-18 Thread David Buchan
Hi, I've made a program that creates two new windows when demanded:   GtkWidget *window1, *scrolled_win1, *textview1;   GtkTextBuffer *buffer1;   GtkWidget *window2, *scrolled_win2, *textview2;   GtkTextBuffer *buffer2;   PangoFontDescription *textview_font1;   PangoFontDescription

Re: Unusual GTK error message

2012-07-21 Thread David Buchan
Frank wrote: You don't have a .local directory in /root Should I? From: Frank Cox thea...@melvilletheatre.com To: gtk-app-devel-list@gnome.org Cc: David Buchan pdbuc...@yahoo.com Sent: Saturday, July 21, 2012 1:10 AM Subject: Re: Unusual GTK error message

Unusual GTK error message

2012-07-20 Thread David Buchan
Background info: My program uses a file chooser dialog. I compiled it for the first time today on a 64-bit machine with Ubuntu 12.04 64-bit with gtk-3-dev. My program is run as root. I've been using it extensively on 32-bit machine with libtgtk2.0-dev and Ubuntu 10.04 with no errors. When I

PS: Unusual GTK error message

2012-07-20 Thread David Buchan
Additional info: The first two errors appear when I press the Open button in the file chooser dialog. The third error appears when I close my program completely. Dave ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org

Re: yet another thread question

2012-07-07 Thread David Buchan
Well, that worked out fine! It creates a smooth user interface experience. Thanks again John. Dave From: jcup...@gmail.com jcup...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Friday, July 6

Re: yet another thread question

2012-07-06 Thread David Buchan
From: jcup...@gmail.com jcup...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Friday, July 6, 2012 3:56 AM Subject: Re: yet another thread question Hi again David, On Friday, 6 July 2012, David Buchan wrote: When the user

Re: yet another thread question

2012-07-06 Thread David Buchan
Wow! Absolutely fantastic. Thanks again John. Dave From: jcup...@gmail.com jcup...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Friday, July 6, 2012 10:16 AM Subject: Re: yet another thread

Another thread/idle/timeout question

2012-07-05 Thread David Buchan
Is there a way to have a (non-main iteration) thread issue a signal when it ends? I start up a timeout and an idle function when I spawn a new thread. I want the main iteration to stop the timeout and idle function as soon as the new thread is finished and disappears. It seems to me that if

Re: Another thread/idle/timeout question

2012-07-05 Thread David Buchan
this is the easiest solution. From: David Buchan pdbuc...@yahoo.com To: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Thursday, July 5, 2012 9:26 AM Subject: Another thread/idle/timeout question Is there a way to have a (non-main iteration) thread issue

Re: Another thread/idle/timeout question

2012-07-05 Thread David Buchan
Aaaah.. I see. Yes, that's exactly what I meant. That's great! Thanks. From: jcup...@gmail.com jcup...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Thursday, July 5, 2012 11:32 AM Subject: Re

yet another thread question

2012-07-05 Thread David Buchan
When the user presses a button, an idle function is begun to watch a flag which will tell it a message has been left in a string for it by a worker thread. The worker thread is then started. It will produce results to be displayed in a textview by the idle function. When the worker thread has

Threads and idle functions

2012-07-02 Thread David Buchan
My understanding is that child threads must never alter the UI in any way. If I have a program which spawns a child thread to download some data and I want to be able to have a dialog pop up should an error occur, is it correct to say that I need an idle function to be running concurrently to

Re: Threads and idle functions

2012-07-02 Thread David Buchan
yep. Seems to be working. Thanks! Dave From: James Morris jwm.art@gmail.com To: David Buchan pdbuc...@yahoo.com Sent: Monday, July 2, 2012 9:10 PM Subject: Re: Threads and idle functions On 3 July 2012 01:50, David Buchan pdbuc...@yahoo.com wrote: My