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 (i

Obtaining pointer to the window with focus

2013-12-09 Thread David Buchan
I've not seen a clear answer to this obvious question. Maybe I'm not searching for the right terms. What I want to do is create a dialog if an error occurs, and I want it to appear atop the window that currently has focus. This seems like a standard thing to do, so it's weird I can't find a cle

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 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

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 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 memo

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

2013-12-04 Thread David Buchan
On 4 December 2013 13:31,  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 Tue, 3 Dec 2013 19:59:22 -0800 (PST) David Buchan 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

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 i

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

2013-12-03 Thread David Buchan
David Buchan 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
David Buchan 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

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: Delay time to spawn new threads?

2013-11-28 Thread David Buchan
On Wed, 27 Nov 2013 19:32:26 -0800 (PST) David Buchan 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 a

Re: Delay time to spawn new threads?

2013-11-27 Thread David Buchan
David Buchan 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 *bu

Re: Delay time to spawn new threads?

2013-11-27 Thread David Buchan
David Buchan 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 *bu

Re: Delay time to spawn new threads?

2013-11-27 Thread David Buchan
ew threads? On 11/27/2013 08: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

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 To: David Buchan Cc: gtk-app-devel-list list Sent: Wednesday, November 27, 2013 1:24 PM Subject: Re: Delay time to spawn new threads? O

Delay time to spawn new threads?

2013-11-27 Thread David Buchan
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, but as a stand-alone program,

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
Great! Thanks! Dave From: "jcup...@gmail.com" To: David Buchan Cc: gtk-app-devel-list list Sent: Tuesday, November 5, 2013 4:56 PM Subject: Re: Valgrind is grinding my gears I have a valgrind file here I use for my large gtk2 prog

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
Aaaah. I see. Thanks guys. From: Bernhard Schuster To: David Buchan Cc: David Nečas ; gtk-app-devel-list list Sent: Tuesday, November 5, 2013 3:59 PM Subject: Re: Valgrind is grinding my gears No, as soon as you use GObject derived types (or call

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
her that's essentially what using G_SLICE=always-malloc would do. I can't try this out until late tonight, unfortunately. From: David Nečas To: David Buchan Cc: gtk-app-devel-list list Sent: Tuesday, November 5, 2013 2:51 PM Subject: Re: Valgrind

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
lable 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 To: gtk-app-devel-list list Sen

Re: Valgrind is grinding my gears

2013-11-05 Thread David Buchan
trouble with g-sliced memory? From: David Buchan To: gtk-app-devel-list list 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 which uses GTK+2. My Makefile has: CC

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 us

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 To: David Buchan Cc: gtk-app-devel-list list Sent: Thursday, May 16, 2013 10:50 PM Subject: Re:

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 pr

Re: GTK tables

2013-01-28 Thread David Buchan
Great! Thanks Tristan. Dave From: Tristan Van Berkom To: David Buchan Cc: gtk-app-devel-list list Sent: Monday, January 28, 2013 1:16 AM Subject: Re: GTK tables On Mon, Jan 28, 2013 at 4:42 AM, David Buchan wrote: > I've created a table with G

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 b

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`

Re: GTK window positioning [SOLVED]

2012-09-19 Thread David Buchan
David Buchan To: gtk-list list Sent: Tuesday, September 18, 2012 9:51 PM Subject: GTK window positioning It just occurred to me that maybe I should be sending to the gtk-list mailing list instead (more active). Pls see below... - Forwarded Message - From: David Buchan To: gtk-app-

Re: GTK window positioning

2012-09-19 Thread David Buchan
devel-list@gnome.org Sent: Wednesday, September 19, 2012 2:53 PM Subject: Re: GTK window positioning David Buchan wrote: >  gtk_window_set_position (GTK_WINDOW (window1), GTK_WIN_POS_NONE); [snip] > > I find that the two windows are always placed right on top of each other. I >

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 *textview_font

Re: Unusual GTK error message

2012-07-21 Thread David Buchan
Thanks! From: Emmanuele Bassi To: David Buchan Cc: gtk-app-devel-list list Sent: Saturday, July 21, 2012 7:43 AM Subject: Re: Unusual GTK error message Hi; This was a bug that was recently fixed in gtk+: https://bugzilla.gnome.org/show_bug.cgi?id

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 To: gtk-app-devel-list@gnome.org Cc: David Buchan Sent: Saturday, July 21, 2012 1:10 AM Subject: Re: Unusual GTK error message On Fri, 20 Jul 2012 18:3

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 https://mail.gnome

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 use

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" To: David Buchan Cc: gtk-app-devel-list list Sent: Friday, July 6, 2012 10:16 AM Subject: Re: yet another thread quest

Re: yet another thread question

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

Re: yet another thread question

2012-07-06 Thread David Buchan
into the textview. Dave From: "jcup...@gmail.com" To: David Buchan Cc: gtk-app-devel-list list 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 presses a button,

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 re

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" To: David Buchan Cc: gtk-app-devel-list list Sent: Thursday, July 5, 2012 11:32 AM Subject: Re: Another thread/idle/timeout question

Re: Another thread/idle/timeout question

2012-07-05 Thread David Buchan
easiest solution. From: David Buchan To: gtk-app-devel-list list 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 a signal when it ends? I start up a timeout and

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 tha

Re: Threads and idle functions

2012-07-02 Thread David Buchan
yep. Seems to be working. Thanks! Dave From: James Morris To: David Buchan Sent: Monday, July 2, 2012 9:10 PM Subject: Re: Threads and idle functions On 3 July 2012 01:50, David Buchan wrote: > My understanding is that child threads must never alter

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 mo