Re: more of a C question than GTK+3.0??
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Fri, Sep 05, 2014 at 09:43:00PM -0400, Chris Moller wrote: What do you mean, fails? What happens? And what do you want to happen? when I try to output the const char *s by casting the buf, with is a string, label1, it is NULL! Yes, no kidding. the next msg explains why. s = gtk_label_get_text(GTK_LABEL(labell); iv'e looked at the following code: label1 = gtk_label_new(1: This is the file name named talk.1.txt); in another directory I have text files in /tmp/files/*; I think the files over there grab the 10 files; *if* I stick the output within gtk_label_new(). I think it may be a matter of putting these files together and grabbing the content of the talk.N.txt and putting them into gtk_label_new(). { I am not explaining anything to this list, but at least I know what I want to try } . On 09/05/14 21:12, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. things that I *thought* might work by using s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf)); fails. (with contains the String label1) I have a index, n that can range from 1 to 99--whatever GtkWidget *label I need. the next thing that occured was some kind of typedef struct { GtkWidget *label1, *label2, *label3, ... *label999; } Labels; can abybody clue on how to use my n index counter to stick one of the labels so they show up on my arrow window? thanks much. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: more of a C question than GTK+3.0??
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. well, I hate to telll fibs, but I'm still at it. It has been years since I listened to my bio; 'snot that bad.. On Sat, Sep 06, 2014 at 09:40:50AM +0200, Gergely Polonkai wrote: What I would do instead is: GtkWidget **label[1000]; // if you have a dynamic number of labels, consider using a GArray maybe int i = 0; label[i++] = gtk_label_new(first text); // this will be label[0] label[i++] = gtk_label_new(second text); // this will be label[1] pretty sure I tried something like this about a week ago. maybe last monday. it may have segv'd. but YES in cp_text.c is :: if (p) { fprintf (stdout, %s, p); L[i++] = p; } here p is the string or stringgs *within* /tmp/file/text.N.txt; I planned on passing L[] to what you have above: first text, second text. in my example text.1.txt files I have (e.g.) i am bringing this laptop to the group so I can be more easily understood. … After this, instead of creating a string label1, you just need the number 1, and can use this: s = gtk_label_get_text(GTK_LABEL(label[1])); where 1 can instead be a variable of int that holds 1: int num = 1; s = gtk_label_get_text(GTK_LABEL(label[num])); many thanks indeed. I'm' going to save your mail and get a hardcopy. tthen join the directories, c. On 6 September 2014 09:32, Gary Kline kl...@thought.org wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Sat, Sep 06, 2014 at 08:08:34AM +0200, Gergely Polonkai wrote: On 6 Sep 2014 03:12, Gary Kline kl...@thought.org wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. things that I *thought* might work by using s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf)); fails. (with contains the String label1) I have a index, n that can range from 1 to 99--whatever GtkWidget *label I need. the next thing that occured was some kind of typedef struct { GtkWidget *label1, *label2, *label3, ... *label999; } Labels; can abybody clue on how to use my n index counter to stick one of the labels so they show up on my arrow window? thanks much. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. This definitely calls for an array: GtkWidget *label[1000]; as you cannot reference to a variable with a constructed name (like $$a in PHP). If your struct holds only pointers, though, you can also cast it to an array: ((GtkWidget **)label_list)[99] but I haven't tested it, and highly discourage it. I will heed your advise! a workaround may be in three *.c files. but first:: sleep. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
more of a C question than GTK+3.0??
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. things that I *thought* might work by using s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf)); fails. (with contains the String label1) I have a index, n that can range from 1 to 99--whatever GtkWidget *label I need. the next thing that occured was some kind of typedef struct { GtkWidget *label1, *label2, *label3, ... *label999; } Labels; can abybody clue on how to use my n index counter to stick one of the labels so they show up on my arrow window? thanks much. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: how to i get the arrow-buttons moving?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Wed, Sep 03, 2014 at 04:45:37PM +0200, Marcus Karlsson wrote: On Tue, Sep 02, 2014 at 04:39:00PM -0700, Gary Kline wrote: here are thee labels that show up when you use the gcc compile string. how do I get the up- and -down arrows to point at the label and echo the label strings? You need to update the view when your signal handler is invoked. All you need is somewhere to store which label is currently selected, update it when the signal handler is called and update the view accordingly; for example by updating the label attributes. You can then use gtk_label_get_text () to fetch the text that a label displays. Marcus thanks for your input, marcus, but could you give me a few lines of code? I tried using the gtk_label_set_text() for over an hour last night until it felt like my shoulder was going to drop off and fall on the floor! other than usinng g_signal_connect() to bail out with a Quit, the only times I see anything to do with a signal are after going GTK_ARROW_UP or _DOWN I may have misplaced the gtk_label_get_text() stuff. iv'e got: gtk_label_get_text(GTK_LABEL(user_data), buf ); which now looks aways off... need more clues. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: how to i get the arrow-buttons moving?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Wed, Sep 03, 2014 at 10:44:55PM +0200, Marcus Karlsson wrote: On Wed, Sep 03, 2014 at 01:13:06PM -0700, Gary Kline wrote: thanks for your input, marcus, but could you give me a few lines of code? I tried using the gtk_label_set_text() for over an hour last night until it felt like my shoulder was going to drop off and fall on the floor! You should be able to set the text with something like: gtk_label_set_text (GTK_LABEL (label), some text); But this requires that you have a valid pointer to your label, eiter in a global variable or passed to the signal handler as the user_data pointer. other than usinng g_signal_connect() to bail out with a Quit, the only times I see anything to do with a signal are after going GTK_ARROW_UP or _DOWN I may have misplaced the gtk_label_get_text() stuff. iv'e got: gtk_label_get_text(GTK_LABEL(user_data), buf ); which now looks aways off... need more clues. Gtk_label_get_text () returns the string in the return value, so you need to to something like: str = gtk_label_get_text (GTK_LABEL (user_data)); This of course also requires that the user_data pointer is pointing at a label. In your code sample you passed 0 and 1 as the pointers, which most likely will not be valid pointers to your labels. It's often a good idea to group the elements that you need to access into an object and pass it as the user_data pointer. A struct would be sufficient. This could also include a field which says which label is currently selected, for example using and int in the range of 1 to 3. If you want to reuse the signal handler and still distinguish which button caused the signal then you can use the currently unused first argument which should point to the sender of the signal, or the button which was pressed down. Marcus well, here's the dope: after my 27th cup of french roast, it's all coming together. *Or*, with a few more hacks, most things will fit. still, no one has been able to answer my main question: how, using the arrow keys, do I attach onto the individual labels? I print 3 labels to demonstrate what will appear of the window. there probably will be dozens of strings that will become labels. I need the up/down arrow keys to select One label. Another part of the program will speak that string. your code examples were helpful. my main snafu was in mixing up the GTK_MACROS. The main step is getting the arrow keys to incicatte--probably with a horizontal line--the right label. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: how to i get the arrow-buttons moving?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Thu, Sep 04, 2014 at 12:32:06AM +0200, Gergely Polonkai wrote: Hello Gary, do I get it right, you want to manupulate/query the labels upon keypresses? Like when the user presses the Up arrow, fetch the text of the first label and print it somewhere? *YES*. in another directory, three or four C files grab hold of [[ Say ]] /tmp/files/text.3.txt {or} /tmp/files/text.NN.txt. these TXT files contain what the speech-ompaired person has typed. they are voiced by espeak and other speech binaries. when I hit the up- or doen-arrow button I want SOmething to appear on the window that has the arrow icons. when the user hits Enter or mouse-clicks, that Something voices what the users himself cannot. In that case, I’d like to know if you have a GtkApplication with GtkApplicationWindows, or “just” a simple GtkWindow? in my arrow.c, in main(), I have a GtkWidget *window; and after gtk_init() is: window = gtk_window_new (GTK_WINDOW_TOPLEVEL); . . . so it is just a simple window. For the former, I would go for actions and accels (see gtk_application_set_accels_for_action() and friends), while the former may require catching the ::key-press-event signal. Best, Gergely I'll google around and see what functions do what! iv'e seen the `accels' scroll past while searching for other parts of code. I had 0.0 idea what it was. :) thanks much, gary On 4 September 2014 00:24, Gary Kline kl...@thought.org wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Wed, Sep 03, 2014 at 10:44:55PM +0200, Marcus Karlsson wrote: On Wed, Sep 03, 2014 at 01:13:06PM -0700, Gary Kline wrote: thanks for your input, marcus, but could you give me a few lines of code? I tried using the gtk_label_set_text() for over an hour last night until it felt like my shoulder was going to drop off and fall on the floor! You should be able to set the text with something like: gtk_label_set_text (GTK_LABEL (label), some text); But this requires that you have a valid pointer to your label, eiter in a global variable or passed to the signal handler as the user_data pointer. other than usinng g_signal_connect() to bail out with a Quit, the only times I see anything to do with a signal are after going GTK_ARROW_UP or _DOWN I may have misplaced the gtk_label_get_text() stuff. iv'e got: gtk_label_get_text(GTK_LABEL(user_data), buf ); which now looks aways off... need more clues. Gtk_label_get_text () returns the string in the return value, so you need to to something like: str = gtk_label_get_text (GTK_LABEL (user_data)); This of course also requires that the user_data pointer is pointing at a label. In your code sample you passed 0 and 1 as the pointers, which most likely will not be valid pointers to your labels. It's often a good idea to group the elements that you need to access into an object and pass it as the user_data pointer. A struct would be sufficient. This could also include a field which says which label is currently selected, for example using and int in the range of 1 to 3. If you want to reuse the signal handler and still distinguish which button caused the signal then you can use the currently unused first argument which should point to the sender of the signal, or the button which was pressed down. Marcus well, here's the dope: after my 27th cup of french roast, it's all coming together. *Or*, with a few more hacks, most things will fit. still, no one has been able to answer my main question: how, using the arrow keys, do I attach onto the individual labels? I print 3 labels to demonstrate what will appear of the window. there probably will be dozens of strings that will become labels. I need the up/down arrow keys to select One label. Another part of the program will speak that string. your code examples were helpful. my main snafu was in mixing up the GTK_MACROS. The main step is getting the arrow keys to incicatte--probably with a horizontal line--the right label. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
how to i get the arrow-buttons moving?
here are thee labels that show up when you use the gcc compile string. how do I get the up- and -down arrows to point at the label and echo the label strings? #include stdio.h #include gtk/gtk.h /* COMPILE WITH: gcc -Wall -Wextra -g arrow.c -o arrow `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` */ GtkWidget * create_arrow_button (GtkArrowType arrow_type, GtkShadowType shadow_type) { GtkWidget *button; GtkWidget *arrow; button = gtk_button_new (); arrow = gtk_arrow_new (arrow_type, shadow_type); gtk_container_add (GTK_CONTAINER (button), arrow); gtk_widget_show (button); gtk_widget_show (arrow); return (button); } static void button_clicked (__attribute__ ((unused)) GtkButton *button, gpointer user_data) { printf (button %d clicked\n, GPOINTER_TO_INT (user_data)); } int main (int argc, char *argv[]) { /* GtkWidget is the storage type for widgets */ GtkWidget *window; GtkWidget *button; GtkWidget *box; GtkWidget *vbox, *vlbox; GtkWidget *label1, *label2, *label3; /* Initialize the toolkit */ gtk_init (argc, argv); /* Create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 850, 500); /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 10); /* It's a good idea to do this for all windows. gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (gtk_main_quit), NULL); */ /* Create a box to hold the arrows/buttons */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 9); gtk_container_add (GTK_CONTAINER (window), vbox); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width (GTK_CONTAINER (box), 2); gtk_container_add (GTK_CONTAINER (vbox), box); button = create_arrow_button (GTK_ARROW_UP, GTK_SHADOW_IN); g_signal_connect (button, clicked, G_CALLBACK (button_clicked), GINT_TO_POINTER (0)); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT); g_signal_connect (button, clicked, G_CALLBACK (button_clicked), GINT_TO_POINTER (1)); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); /* line 100 */ label1 = gtk_label_new(1: This is the file name named talk.1.txt); gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); // left label2 = gtk_label_new(2: This is talk.2.txt); gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); // left label3 = gtk_label_new(3: File talk.3.txt for the speech impaired.); gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); // left vlbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add(GTK_CONTAINER(vbox), vlbox); gtk_box_pack_start(GTK_BOX(vbox), label1, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label2, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label3, FALSE, TRUE, 0); gtk_widget_show (label1); gtk_widget_show (label2); gtk_widget_show (label3); gtk_widget_show_all (window); gtk_main (); return (0); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
appreciate help ...
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. can anybody on this list figure out why the binary fails and how I should fix it? arrow.c is sround 100 lines; to make things simple I am attaching a makefile. the WARNING is a mystery unless the snafu is at line #103... . thanks for any insights. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. # begin make file PROGRAM = arrow PROGRAM_FILES = arrow.c OBJS = arrow.o #configuration for building GTK X applications CFLAGS += -g -Wall $(shell pkg-config --cflags gtk+-3.0) -DGSEAL_ENABLE=1 -DG_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -DGDK_PIXBUF_DISABLE_DEPRECATED=1 -DGTK_DISABLE_DEPRECATED=1 LIBS+= $(shell pkg-config --libs gtk+-3.0) all: arrow file $(PROGRAM) size $(PROGRAM) arrow: $(OBJS) $(CC) -g $(OBJS) -o $(PROGRAM) $(LIBS) clean: @rm -rf $(PROGRAM) $(OBJS) #end make file ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: any ideas for a fix?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Thu, Aug 21, 2014 at 01:01:24PM +0200, Marcus Karlsson wrote: On Tue, Aug 19, 2014 at 06:43:22PM -0700, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. guys, last time I encloused this leftJ* code, it output a 700 by 900 label with label1, label2, label3. in labelWidgets.h I've got a *label[32], and use a global tt=0 that is inc in a for loop. the gcc line builds ./leftJ after you unshar or simply run sh against the sharball. it doesn't segv or anything; but it only printfs the last line. WITH complaiints. can any body help me here? tia, gary Attached: leftJustify.shar Looks like your attachment didn't make it. Can you post the code sample online, or include the problematic part inline? Marcus hi marcus, don't know what happened to the SHAR file. BUT: below is the entire program--minus the labelWidgets.h header. the header file just had the int tt. as-is, this printfs the 700 by 900 window and the third label. last night, localtime here in seattle, I send mail to two chaps named chris, moller and vine. My *main* problem is that I don't know how to add multiple labels to a single vbox. Clue me in and givve me a place to stand, and I'll be able to move the globe! gary #include stdio.h #include gtk/gtk.h // no-more :: #include labelWidgets.h /*** gcc -Wall -g leftJ.c -o leftJ `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` ***/ int main (int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. //GtkWidget *label1, *label2, *label3; GtkWidget *label[32]; int tt = 0; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title (GTK_WINDOW (window), Labels Left-Margins); gtk_container_set_border_width (GTK_CONTAINER (window), 10); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL); for (tt = 0; tt 3; tt++) { printf (For-Loop(): main with tt = (%d)\n, tt); label[tt] = gtk_label_new (1: This is the file name named talk.1.txt); gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5);// left label[tt] = gtk_label_new (2: This is talk.2.txt); gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5);// left label[tt] = gtk_label_new (3: File talk.3.txt file.); gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5);// left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add (GTK_CONTAINER (window), vbox); gtk_box_pack_start (GTK_BOX (vbox), label[tt], FALSE, TRUE, 0); gtk_widget_show (label[tt]); gtk_box_pack_start(GTK_BOX(vbox), label[tt], FALSE, TRUE, 0); gtk_widget_show (label[tt]); gtk_box_pack_start(GTK_BOX(vbox), label[tt], FALSE, TRUE, 0); gtk_widget_show (label[tt]); gtk_widget_show_all (window); } gtk_main (); return 0; } -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: any ideas for a fix?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Thu, Aug 21, 2014 at 01:41:46PM -0700, Phil Wolff wrote: You're trying to use each label in three places, and you can't do that. Try this: thanks, phil; I can see how this ought to work. the thing is that I want a GtkWidget *Label[NN] and this is because another part of my GTK-3 program writes to /home/USER/.Text/talk.K.txt where each ~/.Text/*txt file has from a few characters to a few paragraphs. another part of the program reads and counts the number tt of txt files and copies it to this part of the GTK program. gary PS: OF course it's free, open, blah*3, and should be v useful. int main (int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. //GtkWidget *label1, *label2, *label3; GtkWidget *label1[32], *label2[32], *label3[32]; int tt = 0; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title (GTK_WINDOW (window), Labels Left-Margins); gtk_container_set_border_width (GTK_CONTAINER (window), 10); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL); for (tt = 0; tt 3; tt++) { printf (For-Loop(): main with tt = (%d)\n, tt); label1[tt] = gtk_label_new (1: This is the file name named talk.1.txt); gtk_misc_set_alignment (GTK_MISC (label1[tt]), 0, 0.5); // left label2[tt] = gtk_label_new (2: This is talk.2.txt); gtk_misc_set_alignment (GTK_MISC (label2[tt]), 0, 0.5); // left label3[tt] = gtk_label_new (3: File talk.3.txt file.); gtk_misc_set_alignment (GTK_MISC (label3[tt]), 0, 0.5); // left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add (GTK_CONTAINER (window), vbox); gtk_box_pack_start (GTK_BOX (vbox), label1[tt], FALSE, TRUE, 0); gtk_widget_show (label1[tt]); gtk_box_pack_start(GTK_BOX(vbox), label2[tt], FALSE, TRUE, 0); gtk_widget_show (label2[tt]); gtk_box_pack_start(GTK_BOX(vbox), label3[tt], FALSE, TRUE, 0); gtk_widget_show (label3[tt]); gtk_widget_show_all (window); gtk_widget_show_all (window); } gtk_main (); return 0; } On 08/21/2014 01:30 PM, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Thu, Aug 21, 2014 at 01:01:24PM +0200, Marcus Karlsson wrote: On Tue, Aug 19, 2014 at 06:43:22PM -0700, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. guys, last time I encloused this leftJ* code, it output a 700 by 900 label with label1, label2, label3. in labelWidgets.h I've got a *label[32], and use a global tt=0 that is inc in a for loop. the gcc line builds ./leftJ after you unshar or simply run sh against the sharball. it doesn't segv or anything; but it only printfs the last line. WITH complaiints. can any body help me here? tia, gary Attached: leftJustify.shar Looks like your attachment didn't make it. Can you post the code sample online, or include the problematic part inline? Marcus hi marcus, don't know what happened to the SHAR file. BUT: below is the entire program--minus the labelWidgets.h header. the header file just had the int tt. as-is, this printfs the 700 by 900 window and the third label. last night, localtime here in seattle, I send mail to two chaps named chris, moller and vine. My *main* problem is that I don't know how to add multiple labels to a single vbox. Clue me in and givve me a place to stand, and I'll be able to move the globe! gary #include stdio.h #include gtk/gtk.h // no-more :: #include labelWidgets.h /*** gcc -Wall -g leftJ.c -o leftJ `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` ***/ int main (int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. //GtkWidget *label1, *label2, *label3; GtkWidget *label[32]; int tt = 0; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title (GTK_WINDOW (window), Labels Left-Margins); gtk_container_set_border_width (GTK_CONTAINER (window), 10); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL
Re: any ideas for a fix?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. I still only get this:: For-Loop(): main with tt = (0) For-Loop(): main with tt = (1) (leftJ:22024): Gtk-WARNING **: Attempting to add a widget with type GtkBox to a GtkWindow, but as a GtkBin subclass a GtkWindow can only contain one widget at a time; it already contains a widget of type GtkBox For-Loop(): main with tt = (2) (leftJ:22024): Gtk-WARNING **: Attempting to add a widget with type GtkBox to a GtkWindow, but as a GtkBin subclass a GtkWindow can only contain one widget at a time; it already contains a widget of type GtkBox pts/101 17:17 tao [5481] Dunno... . On Thu, Aug 21, 2014 at 01:41:46PM -0700, Phil Wolff wrote: You're trying to use each label in three places, and you can't do that. Try this: int main (int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. //GtkWidget *label1, *label2, *label3; GtkWidget *label1[32], *label2[32], *label3[32]; int tt = 0; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title (GTK_WINDOW (window), Labels Left-Margins); gtk_container_set_border_width (GTK_CONTAINER (window), 10); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL); for (tt = 0; tt 3; tt++) { printf (For-Loop(): main with tt = (%d)\n, tt); label1[tt] = gtk_label_new (1: This is the file name named talk.1.txt); gtk_misc_set_alignment (GTK_MISC (label1[tt]), 0, 0.5); // left label2[tt] = gtk_label_new (2: This is talk.2.txt); gtk_misc_set_alignment (GTK_MISC (label2[tt]), 0, 0.5); // left label3[tt] = gtk_label_new (3: File talk.3.txt file.); gtk_misc_set_alignment (GTK_MISC (label3[tt]), 0, 0.5); // left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add (GTK_CONTAINER (window), vbox); gtk_box_pack_start (GTK_BOX (vbox), label1[tt], FALSE, TRUE, 0); gtk_widget_show (label1[tt]); gtk_box_pack_start(GTK_BOX(vbox), label2[tt], FALSE, TRUE, 0); gtk_widget_show (label2[tt]); gtk_box_pack_start(GTK_BOX(vbox), label3[tt], FALSE, TRUE, 0); gtk_widget_show (label3[tt]); gtk_widget_show_all (window); gtk_widget_show_all (window); } gtk_main (); return 0; } On 08/21/2014 01:30 PM, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Thu, Aug 21, 2014 at 01:01:24PM +0200, Marcus Karlsson wrote: On Tue, Aug 19, 2014 at 06:43:22PM -0700, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. guys, last time I encloused this leftJ* code, it output a 700 by 900 label with label1, label2, label3. in labelWidgets.h I've got a *label[32], and use a global tt=0 that is inc in a for loop. the gcc line builds ./leftJ after you unshar or simply run sh against the sharball. it doesn't segv or anything; but it only printfs the last line. WITH complaiints. can any body help me here? tia, gary Attached: leftJustify.shar Looks like your attachment didn't make it. Can you post the code sample online, or include the problematic part inline? Marcus hi marcus, don't know what happened to the SHAR file. BUT: below is the entire program--minus the labelWidgets.h header. the header file just had the int tt. as-is, this printfs the 700 by 900 window and the third label. last night, localtime here in seattle, I send mail to two chaps named chris, moller and vine. My *main* problem is that I don't know how to add multiple labels to a single vbox. Clue me in and givve me a place to stand, and I'll be able to move the globe! gary #include stdio.h #include gtk/gtk.h // no-more :: #include labelWidgets.h /*** gcc -Wall -g leftJ.c -o leftJ `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` ***/ int main (int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. //GtkWidget *label1, *label2, *label3; GtkWidget *label[32]; int tt = 0; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title (GTK_WINDOW (window), Labels Left-Margins); gtk_container_set_border_width (GTK_CONTAINER (window), 10
Re: any ideas for a fix?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Thu, Aug 21, 2014 at 10:44:41PM +0200, Colomban Wendling wrote: Le 21/08/2014 22:30, Gary Kline a écrit : [...] { printf (For-Loop(): main with tt = (%d)\n, tt); label[tt] = gtk_label_new (1: This is the file name named talk.1.txt); gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5);// left label[tt] = gtk_label_new (2: This is talk.2.txt); gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5);// left label[tt] = gtk_label_new (3: File talk.3.txt file.); You assign to the same array index three times (label[tt] = /*...*/; label[tt] = /*...*/; label[tt] = /*...*/) gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5);// left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add (GTK_CONTAINER (window), vbox); gtk_box_pack_start (GTK_BOX (vbox), label[tt], FALSE, TRUE, 0); gtk_widget_show (label[tt]); gtk_box_pack_start(GTK_BOX(vbox), label[tt], FALSE, TRUE, 0); gtk_widget_show (label[tt]); gtk_box_pack_start(GTK_BOX(vbox), label[tt], FALSE, TRUE, 0); gtk_widget_show (label[tt]); ...and pack the same widget (label[tt]) three times. GTK widgets can only have one parent, adding them several times is incorrect. You need to pack the first widget before setting the label[tt] to the new one. Or more likely, you need to remove the loop and use 3 different variables (or indexes), the loop seems to be misused. A loop runs the *same* body several times, it doesn't magically make different assignations to the same index work like if they were different ones. Regards, Colomban ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list attached is what I had on tuesday the 19th it is l2.c and creates a 700 by 900 window and three label strings. not quite right... cheers! gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
any ideas for a fix?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. guys, last time I encloused this leftJ* code, it output a 700 by 900 label with label1, label2, label3. in labelWidgets.h I've got a *label[32], and use a global tt=0 that is inc in a for loop. the gcc line builds ./leftJ after you unshar or simply run sh against the sharball. it doesn't segv or anything; but it only printfs the last line. WITH complaiints. can any body help me here? tia, gary Attached: leftJustify.shar -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: how to i [or DO i] use LEFT-JUSTY here?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Wed, Aug 13, 2014 at 09:23:48PM -0700, Jordan wrote: Hi, Gary. Maybe I'm not clear on what you want to accomplish. Are you wanting to have a numbered list with padding? Screenshots/diagrams/mockups are definitely welcome! :-D How you're doing it seems fine to me. As long as it gets the job done you're doing it right :-) hi jordan, damn, I wrote around 15 lines; it got lost... Anyway, I'm inclosing a screenshot to demo that the 40 lines does do what I want. the gotcha is that I'm pretty sure that the newest GTK --3.0--was to NOT use how I had leftJ.c coded. it works the way I want, tho. I do not know what you mean by padding; it is or may be a fine point, but in time this stuff may give me troubles. ---if you had the GTK 3 libraries installed I do have the gcc compile and link line. Other alternatives: gtk_label_set_justify: (https://developer.gnome.org/gtk3/unstable/GtkLabel.html#gtk-label-set-justify). You can use this in addition to setting the widget padding. can you point me to some example code? my leftJ.c was my example [!] ciao! gary Included: a *png file. On Wednesday, August 13, 2014 06:12:32 PM Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. people, is this correct for GTK+ 3.0 or how should I use a justify-Left function in the 40-some lines below? tthanks much! /* Cut Here */ #include stdio.h #include gtk/gtk.h /*** gcc -Wall -g leftJ.c -o leftJ `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` ***/ int main(int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. GtkWidget *label1, *label2, *label3; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title(GTK_WINDOW(window), Labels Left-Margins); gtk_container_set_border_width(GTK_CONTAINER(window), 10); g_signal_connect(window, destroy, G_CALLBACK(gtk_main_quit), NULL); label1 = gtk_label_new(1: This is the file name named talk.1.txt); gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); // left label2 = gtk_label_new(2: This is talk.2.txt); gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); // left label3 = gtk_label_new(3: File talk.3.txt for third trial.); gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); // left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add(GTK_CONTAINER(window), vbox); gtk_box_pack_start(GTK_BOX(vbox), label1, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label2, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label3, FALSE, TRUE, 0); gtk_widget_show_all (window); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
how to i [or DO i] use LEFT-JUSTY here?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. people, is this correct for GTK+ 3.0 or how should I use a justify-Left function in the 40-some lines below? tthanks much! /* Cut Here */ #include stdio.h #include gtk/gtk.h /*** gcc -Wall -g leftJ.c -o leftJ `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` ***/ int main(int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. GtkWidget *label1, *label2, *label3; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title(GTK_WINDOW(window), Labels Left-Margins); gtk_container_set_border_width(GTK_CONTAINER(window), 10); g_signal_connect(window, destroy, G_CALLBACK(gtk_main_quit), NULL); label1 = gtk_label_new(1: This is the file name named talk.1.txt); gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); // left label2 = gtk_label_new(2: This is talk.2.txt); gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); // left label3 = gtk_label_new(3: File talk.3.txt for third trial.); gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); // left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add(GTK_CONTAINER(window), vbox); gtk_box_pack_start(GTK_BOX(vbox), label1, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label2, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label3, FALSE, TRUE, 0); gtk_widget_show_all (window); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. well, I've been at this for more than 9 hours. almost nonstop. need the list's help. while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: 1. label1 text, blah**3. 2 label2 text: whatever . . . N. LabelN: text: more label strings ?? I have googled here and there. only one of my foobar.c files *seems* to print from the left. (there is lots more to this test; getting the list of labels or strings neatly printed is only the start.) thanks, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 10:36:03AM +0100, Chris Vine wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris thanks to you and tony newman, both. you included what I needed most: code! so far I don't believe I've used gtk_set_justify; I appreciate the tip. I'll google up the function for v 3.0 if it's still there but would I justify separate labels (say: label1, label2, label3 OR label[i]? BTW, if I seem a bit dense about GTK+, it's because I graduated in 1982... barely audio back then! gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 03:37:03PM -0400, Chris Moller wrote: It's actually gtk_*label*_set_justify (). noted; thanks. On 07/29/14 15:22, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 10:36:03AM +0100, Chris Vine wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris thanks to you and tony newman, both. you included what I needed most: code! so far I don't believe I've used gtk_set_justify; I appreciate the tip. I'll google up the function for v 3.0 if it's still there but would I justify separate labels (say: label1, label2, label3 OR label[i]? BTW, if I seem a bit dense about GTK+, it's because I graduated in 1982... barely audio back then! gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 03:37:03PM -0400, Chris Moller wrote: It's actually gtk_*label*_set_justify (). POST LAST SCRIPT, :):: I came across something like the allignment + [[i thought]], 0,0,0,5. I Did Not understand it after 7 or 8 hours. that was when I backed away from the computers and sacked out. ...i just cd'd to ~/devel and greped for justify. Zip. On 07/29/14 15:22, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 10:36:03AM +0100, Chris Vine wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris thanks to you and tony newman, both. you included what I needed most: code! so far I don't believe I've used gtk_set_justify; I appreciate the tip. I'll google up the function for v 3.0 if it's still there but would I justify separate labels (say: label1, label2, label3 OR label[i]? BTW, if I seem a bit dense about GTK+, it's because I graduated in 1982... barely audio back then! gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 08:06:24PM -0003, Tristan Van Berkom wrote: On Tue, Jul 29, 2014 at 6:36 AM, Chris Vine ch...@cvine.freeserve.co.uk wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Note that since GTK+-3.0 there are the 'halign' and 'valign' properties of GtkWidget which accomplish the same as setting the GtkMisc alignment properties. These are preferred and the GtkMisc API, while not officially deprecated, is not recommended for use in new code[0]. Instead, you should be able to use: gtk_widget_set_halign (label, GTK_ALIGN_START); This should align whatever widget to the left of the available space for the given widget (or to the right in RTL mode) - this API can also be used for any widget (it is not limited to GtkMisc derived widgets). Cheers, -Tristan [0]: https://developer.gnome.org/gtk3/stable/GtkMisc.html I'm going over the url you gave. I got up super early today for my daughter who is going to study comp-sci this fall(!); so I really do need more coffee or a *nap*. meanwhile, below is a testfile that print N labels [[ here N == 3 ]]. Id send you the makefiles, but figure you can mouse the gcc line. x2 is my lack of imagination. at any rate, iv'e used the GTK__MISC string--macro? everything I'm coding from now on is 3.0, so could you edit in the recommended way? you've got halign; shouldn t I use the valign for mmy labels? tx much, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. #include stdio.h #include gtk/gtk.h /*** gcc -Wall -g x2.c -o x2 `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` ***/ int main(int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. GtkWidget *label1, *label2, *label3; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title(GTK_WINDOW(window), Labels Left-Margins); gtk_container_set_border_width(GTK_CONTAINER(window), 10); g_signal_connect(window, destroy, G_CALLBACK(gtk_main_quit), NULL); label1 = gtk_label_new(1: This is the file name named talk.1.txt); gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); // left label2 = gtk_label_new(2: This is talk.2.txt); gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); // left label3 = gtk_label_new(3: File talk.3.txt for the speech impaired.); gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); // left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add(GTK_CONTAINER(window), vbox); gtk_box_pack_start(GTK_BOX(vbox), label1, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label2, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label3, FALSE, TRUE, 0); gtk_widget_show_all (window); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
wedged on enclosed with arrow code
well, after racking up somewhere in the neighborhood of 25 hours, I'm stuck. the snippet below is from my *voice* code. this program is in the Accessibility category and intended for the users who are speech-impaired. the others can presumable speak and hear normally. every sentence/word/paragraph the impaired user types is stored in /usr/share/voice. lets assume that the user had a laptop or tablet and meets with his friends at a starbucks. before long, the textfiles in /usr/share/voice {{*may*}} run into the scores. just in case somebody asks the user to re-read or re-play something he said before I want the user to be able to arrow-up or -down until he finds the misunderstood text string. right now, most of my program works. I use gvim with a simple set of instructions; the program uses espeak and aplay to voice what is typed. the problem is if there are more than a few strings to search. (each filename opens a separate gvim. there are Next, Prev, Play, Quit buttons on each gvim. searching thru many typewritten entries can get messy.) Having a separate button without a gvim would be far easier. /* from voice.c */ filename = g_build_filename (vhome, ifbuf, NULL); infile = fopen (filename, r); if (infile) { while (1) { nchars = fread (file_buff, 1, MAXCHAT, infile); gtk_text_buffer_insert (buffer, iter, file_buff, nchars); if (nchars MAXCHAT) break; } fclose (infile); } else { g_print (\nERROR! could not open %s\n, filename); } hope this makes sense! -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
need help putting up/down arrows into Small square
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. Guys, I've been at this before noon; bushed. it compiles as-is with GTK 2.0 but if you use 3.0 you need to comment out the lines around +47. since nobody out there in GTK land can help I am going back to the wayi did most of the program. brrute force. I figure if I can cram the up and down arrows into a small square then I will be able to expand the TOPLEVEL window into something like 850 by 1500 and put my 30 to 50 text.[i].txt into the large rectange. take it from there. Encl arrow.c -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. /* COMPILE WITH: gcc -Wall -Wextra -g arrow.c -o arrow `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ #include gtk/gtk.h /* Create an Arrow widget with the specified parameters * and pack it into a button */ GtkWidget * create_arrow_button (GtkArrowType arrow_type, GtkShadowType shadow_type) { GtkWidget *button; GtkWidget *arrow; button = gtk_button_new (); arrow = gtk_arrow_new (arrow_type, shadow_type); gtk_container_add (GTK_CONTAINER (button), arrow); gtk_widget_show (button); gtk_widget_show (arrow); return (button); } int main (int argc, char *argv[]) { /* GtkWidget is the storage type for widgets */ GtkWidget *window; GtkWidget *button; GtkWidget *box; GtkWidget *hbox, *vbox; /* Initialize the toolkit */ gtk_init (argc, argv); /* Create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 850, 100); /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 10); /* It's a good idea to do this for all windows. gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (gtk_main_quit), NULL); */ /* Create a box to hold the arrows/buttons */ box = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (box), 2); gtk_container_add (GTK_CONTAINER (window), box); button = create_arrow_button (GTK_ARROW_UP, GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); //hbox = gtk_hbox_new(FALSE, 2); gtk_widget_show_all (window); /* Rest in gtk_main and wait for the fun to begin! */ gtk_main (); return (0); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: need help putting up/down arrows into Small square
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Sat, Jul 19, 2014 at 07:59:59PM -0400, Chris Moller wrote: Compiles fine for me under gtk3-3.10.9-1, only complaining about line 67: box = gtk_hbox_new (FALSE, 0); That's deprecated and should be box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); It creates a wide, mostly empty, window with a couple of big up/down buttons at the left. tthanks, bbut it isn't what I had in mind. I want a small SQUARE box surrounding the two arrows. then I will increase the gtk_window_set_default_size() for 840, 100 to {oh}, around 850, 1500 (around line 41). I have an array of strings /* pseudo code */ chat *text[512] = hi, hello, yes, no, foobar, I'm fine, how are you; I want the arrows in a small square box on the upper left, and the array of strings on the right-hand side. when I have figured out [[!!!]] how to make the arrows activate the array of strinngs, that's next. right now, since I havent hacked any GTK+ for *years*, iam RE-learning how by brute-force. trial and error and by digging in my files from around 2009. gary ps: thanks for clueing me in on the deprecation REattaching your clean-up :_) /* COMPILE WITH: gcc -Wall -Wextra -g arrow.c -o arrow `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` */ #include gtk/gtk.h /* Create an Arrow widget with the specified parameters * and pack it into a button */ GtkWidget *create_arrow_button( GtkArrowType arrow_type, GtkShadowType shadow_type ) { GtkWidget *button; GtkWidget *arrow; button = gtk_button_new(); arrow = gtk_arrow_new (arrow_type, shadow_type); gtk_container_add (GTK_CONTAINER (button), arrow); gtk_widget_show(button); gtk_widget_show(arrow); return(button); } int main( int argc, char *argv[]) { /* GtkWidget is the storage type for widgets */ GtkWidget *window; GtkWidget *button; GtkWidget *box; GtkWidget *hbox, *vbox; /* Initialize the toolkit */ gtk_init (argc, argv); /* Create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(window), 850, 100); /* Sets the border width of the window. */ gtk_container_set_border_width(GTK_CONTAINER(window), 10); /* It's a good idea to do this for all windows. Commented out w/3.0 gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (gtk_main_quit), NULL); */ /* Create a box to hold the arrows/buttons */ //box = gtk_hbox_new (FALSE, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width (GTK_CONTAINER (box), 2); gtk_container_add (GTK_CONTAINER (window), box); button = create_arrow_button(GTK_ARROW_UP, GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); button = create_arrow_button(GTK_ARROW_DOWN, GTK_SHADOW_OUT); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); //hbox = gtk_hbox_new(FALSE, 2); gtk_widget_show_all(window); /* Rest in gtk_main and wait for the fun to begin! */ gtk_main (); return(0); } /* example-end */ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
how to choose oneOf[] an array of sentences?
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 27++ years of service to the Unix community. Guys, I'm having trouble getting my voice/speech program to use many fewer instantiations of gvim. Having 2 or 3 copies of gvim on-screen and fed thru a text-to-speech program like espeak works fine. {My speech is impaired, so I can and have used my program when friends are over. It is *drastically* easier typing what I want to say and having the computer echo my typewritten words than waste minutes repeating myself until I can get my meaning across} When if I have written more than a few things and have them read to a friend, my display gets crammed with gvim windows and text, it takes a lot of work to keep the display readable. It would be nice to capture *everything* I have written and catenate and display them in just One gvim window so that if my friends asks me to repeat/replay something I had said 10 minutes ago, I wouldn't have to search back, back, back... . [[ Closing a bunch if gvim windows until I've found what I had said {or typed} several minutes before.]] All the text files are stored in something like talk[N].txt. It would be easy to find and bundle all the talk files in a bundle. What I am having trouble with in Arrowing UP or DOWN to select the desired text[K].txt file and have it read back to the person who wants it repeated. A fellow hacker thousands of clicks from where I live is a guru at GTK+-3 and others have helped with my VBC program. The thing is that he isn't entirely well either. I don't want to bother anyone on this list or any other list or forum, but I can't figure any other way of getting the job done. One way of resolving the problem and that might be to have something like this in one gvim:: === My sentence or paragraph #1. (Friend replies in speech.) === My sentence or paragraph #2. (Friend replies verbally.) My sentence or paragraph #15 or some N. What if or *when* my friend claims to have forgotten what the computer had voiced and wants me to replay it? (Friend says, I don't remember what you were saying above on the Faculty issue. Can you re-play that one part?) ==SO==, rather than retype what I remembered, and it could be a Yes or No, or several sentences, I would have the program cat the text files together to be read with eyes until the line or lines was found. Given 5 or 10 or 17 of my typings, how would a GTK3 hacker handle that: selecting the right paragraphs to be repeated?? === (Things can get into trouble if my friend asks me to go up to {say} the 4th or 5th thing I have typed.) Then in this gvim, I would press ESC and k or arrow up to the misunderstood thing in the list. I then hit enter/cr and the computer replays that string or strings. This is where I get wedged. Enough for now. I'd be much obliged for any help or feedback! I'm going to append/attach a tarball of VBC and hope that somebody who knows GTK3 and C can lend a helping hand and code. --- A final note is that if this is the wrong list to ask this question, or if anyone knows of other lists, to please forward and cc: me. Thanks muchly! gary kline Attachments: vbc.tgz, dotVBCtar -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-seven years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can I install both GTK+2 and GTK+3?
Hello people, Apologies if this is the wrong place to post my questions, but they involve Ubuntu 13.04 and GTK+ as well. A few weeks ago I finished porting my program for the speech-impaired to Ubuntu 12.04 LTS. This is intended for the OLPC project and also runs on Fedora. Now that my program runs on 12.04 I figure it should work on 13.04 LTS without any mods. In previous versions of Ubuntu, upgrading to the next LTS was nothing more than a few mouse clicks but not now. Does anybody on this gtk list who uses Ubuntu have any idea where I am messing up? My other question involves porting my speech program to laptop.org. Several other hackers have helped with the gtk code; it is mostly 3.x. The nutshell is: should I just hand my program to the sugar-devel folk and be willing to help with what it needs {espeak, [g]vim, and whatever else} or what? thanks for any help, gary On Fri, May 17, 2013 at 03:50:57AM +0100, Emmanuele Bassi wrote: hi; yes, you most definitely can have gtk 2.x and gtk 3.x installed on the same machine, without them interfering with each other. the shared libraries and ancillary files are all parallel installable. what you cannot do is using gtk 2.x *and* gtk 3.x at the same time, in the same process. if you want to write your application to support both gtk 2.x and 3.x, you can do that only by compiling once against gtk 2.x and again against gtk 3.x — i.e. you will need two binaries. targeting gtk 2.x is not a good idea, though, unless you're migrating from 2.x to 3.x and you want to have a grace period for your users to switch. gtk 3.x is already 2.5 years old, and will be 3 years old when 3.10 is released this September. ciao, Emmanuele. On 17 May 2013 03:40, David Buchan pdbuc...@yahoo.com wrote: 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 program for those with GTK+2 and those with GTK+3. Maybe I'm safer to use two separate machines to compile. Unity seems delicate. Dave ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- W: http://www.emmanuelebassi.name B: http://blogs.gnome.org/ebassi/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-six years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
why the menu item Options/SetVoice won't exit
guys, I'm clueless here. in my test voice.c, my widget based on gespeaker works fine. I can change the voice from Male to Female, change the pitch, Speed [WPM], Volume, etc. when I press the Close button, voice.c fprintf's the changes to the setVoice file, and closes nice and clean. when I insert this same code into my voice-by-computer program, if the user opens Options/SetVoice option to [[ let's say ]] change the gender from Male to Female, then presses Close, the callback hangs. Any ideas what I need to add to the Xoptions() function? it is just a modified main() from voice.c: int Xoptions (int argc, char *argv[]) { } which has the dialog settings thus:: dialog = gtk_dialog_new_with_buttons (Voice Settings, GTK_WINDOW (parent_window), 0, GTK_STOCK_REVERT_TO_SAVED, //revert button which GTK_RESPONSE_CANCEL,// returns a cancel response GTK_STOCK_CLOSE,//close button which GTK_RESPONSE_ACCEPT,// returns an accept response NULL// mark the end of our buttons (we could have more) ); In the GtkItemsFactoryEntry menu_items[], icall Xoptions() like so: {/Options/SetVoice, NULL, Xoptions, 0, NULL}, I do not understand why, in the test widget, yes, using main(), it reads in the default settings and if the slider or the radio buttons are changed, voice.c correctly rewrites the setVoice file. but when I insert this code into my vouvebycomputer gnu-accessibility program, things hang when I hit Close [[or Revert Anybody? this is my program's last bug! gary kline -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-six years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
one function to go...
guys, I need one 'quit' button in a small widget that says via the label = gtk_label_new(File does not exist);, and displays OK with the Enter key icon. Instead of having the user click on a Quit or Close button, just hitting Enter would return control to the calling function. I already have the Close code roughed out. I want the GTK_BUTTON_OK in there to let hitting Enter work. thanks for any clues. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-six years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: one function to go...
On Sun, Dec 23, 2012 at 10:57:47PM +0100, Andreas Rönnquist wrote: On Sun, 23 Dec 2012 13:39:46 -0800, Gary Klinekl...@thought.org wrote: guys, I need one 'quit' button in a small widget that says via the label = gtk_label_new(File does not exist);, and displays OK with the Enter key icon. Instead of having the user click on a Quit or Close button, just hitting Enter would return control to the calling function. I already have the Close code roughed out. I want the GTK_BUTTON_OK in there to let hitting Enter work. thanks for any clues. Do you mean that you have a OK button, and that button should be activated when pressing enter? in this popup dialog I would have a few words that the file does not exist and want a button WITH the Enter-key icon that gives an iconic clue that all the user need do is hit the enter key. I suppose if the users could, if they wished, mouse-click on the button. In that case, the function gtk_widget_grab_focus might help: http://developer.gnome.org/gtk3/3.6/GtkWidget.html#gtk-widget-grab-focus thanks for the URL; I'Ll give it a look! -- Andreas Rönnquist mailingli...@gusnan.se gus...@gusnan.se ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-six years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: one function to go...
On Mon, Dec 24, 2012 at 12:37:07AM +0100, David Nečas wrote: On Sun, Dec 23, 2012 at 02:35:31PM -0800, Gary Kline wrote: in this popup dialog I would have a few words that the file does not exist and want a button WITH the Enter-key icon that gives an iconic clue that all the user need do is hit the enter key. I suppose if the users could, if they wished, mouse-click on the button. I cannot speak for your target audience but according to my experience (a) if people see a message box with a single button (probably with some visual clue that it has focus) they will just press Enter or Esc to make it go away, or (b) if people see a button they will always use the pointer to click on the button no matter what other, possibly much simpler, means may be available to activate it. This is a strict division with little between. There is no way to migrate people from (b) to (a), you can try for years with no effect. So targetting those between you may find you are targetting a group of size zero. Just my 2 eurocents... Yeti point well taken. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-six years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
vbc.tgz and dD.c == voptions.c enclosed.
Folks, Attached in my vbc.tgz tarball; this is my working VBC program. As-is, it works/installs only with /home/kline/.VBC; then runs when you type make. make builds ./vbc. Typing /home/kline/.VBC/vbc brings up the application. Mouse-clicking on the second of the three lower buttons, Run Text-To-Speech invokes gvim and espeak. As-is, VBC would only with a male voice and the voice options. Below, is the file I need help integration into the top menu bar Options. This lets the speech- impaired user the choice of changing gender and several other espeak options. This is where I get into trouble. Lines +433-437 or so below explain part of my problems. I think I have taken this project about as far as I can without some assistance. I need help from the gnome-accessibility group as I work to modify and improve this program for the disabled. Just that right *now* I'm hoping this list can help me with the voice options code. thanks much, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc Twenty-six years of service to the Unix community. /* gcc -Wall -Wextra -g voptions.c -o xV `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ /* from here make this into:: Options callback */ #include gtk/gtk.h #include string.h #include stdlib.h // for exit() #define PITCH 17.0 #define SPEED 100.0 #define VOLUME 100.0 #define DELAY 3.0 enum { MALE, FEMALE }; #define CONFIG /tmp/chatConfig /* globals */ GtkWidget *gender_radio_male; GtkWidget *gender_radio_female; GtkWidget *pitch_scale1; GtkWidget *speedWPM_scale2; GtkWidget *volume_scale3; GtkWidget *delay_scale4; int valueGender = MALE; // default double valuePitch, valueSpeed, valueVolume, valueDelay; /* end globals */ /* main prog writes default; this fn read and asks if ok */ void data_inout(); FILE *ifp, *ofp; /* in and out FILE pointers for fopen */ #define FALSE(0) #define TRUE(~0) static void cb_gender_toggled (GtkToggleButton *button, gpointer userdata) { int malefemale = (int)userdata; if (gtk_toggle_button_get_active (button)) { if (malefemale == MALE) { fprintf(stdout, Male \n); } else if (malefemale == FEMALE) { fprintf(stdout, Female \n); } } valueGender = malefemale; fprintf(stderr,valueGender: %d\n,valueGender); } static void hscale_value_changed_pitch (GtkRange *hscale, GtkWindow *parentWindow) { valuePitch = gtk_range_get_value(hscale); //fprintf(stderr,hscale pitch value: %g\n,valuePitch); if (valueGender == 0) { fprintf(stdout, \ngender is Male\n); } else { fprintf(stdout, \ngender is Female\n); } fprintf(stdout,In _pitch_: patch = %g, speed = %g, volume = %g delay = %g\n, valuePitch, valueSpeed, valueVolume, valueDelay); } static void hscale_value_changed_speed (GtkRange *hscale, GtkWindow *parentWindow) { valueSpeed = gtk_range_get_value(hscale); fprintf(stderr,hscale speed value: %g\n,valueSpeed); } static void hscale_value_changed_volume (GtkRange *hscale, GtkWindow *parentWindow) { valueVolume = gtk_range_get_value(hscale); fprintf(stderr,hscale volume value: %g\n,valueVolume); } static void hscale_value_changed_delay (GtkRange *hscale, GtkWindow *parentWindow) { valueDelay = gtk_range_get_value(hscale); fprintf(stderr,hscale delay value: %g\n,valueDelay); } int main (int argc, char *argv[]) { /* * Declare the GTK Widgets used in the program */ GtkWidget *dialog; GtkWidget *main_hbox; //hbox1 GtkWidget *gender_frame; GtkWidget *gender_align; GtkWidget *gender_hbox; // hbox2 GtkWidget *params_frame; GtkWidget *params_align; GtkWidget *params_table; GtkWidget *temp_widget; GtkWidget *parent_window; /* Initialize GTK */ gtk_init (argc, argv); parent_window = NULL; //Set to parent window if you want the dialog box //to block access to the other windows in the app //while it is open and running. dialog = gtk_dialog_new_with_buttons (Voice Settings, GTK_WINDOW (parent_window), 0, GTK_STOCK_REVERT_TO_SAVED, //revert button which GTK_RESPONSE_CANCEL,// returns a cancel response GTK_STOCK_CLOSE,//close button which GTK_RESPONSE_ACCEPT,// returns an accept response NULL// mark the end of our buttons (we could have more) ); gtk_window_set_title ( GTK_WINDOW ( dialog ) , VBC Espeak Options); gtk_widget_set_usize( GTK_WIDGET ( dialog ) , 600 , 400 ); //GTK_WINDOW ( dialog ) -allow_shrink = TRUE; /* * dialog boxes have
Re: need help with final callback
On Thu, Jul 19, 2012 at 12:24:13PM +0200, Gabriele Greco wrote: Date: Thu, 19 Jul 2012 12:24:13 +0200 From: Gabriele Greco gabriele.gr...@darts.it Subject: Re: need help with final callback To: Gary Kline kl...@thought.org, gtk-app-devel-list gtk-app-devel-list@gnome.org Guys, I need your help with the last piece of my voice-by-computer program. the appended section compiles to the binary xD that lets the user choose the gender, word-per-minute speed, delay-between-words, and pitch of th e voice. Without this 'option' the user would type hello and hit enter, a male voice would sound thru the speakers. I don't understand what is the object of your help request. Your program seems to work. Do you need to add a text entry to it so that you can write inside it and call an external program to render the speech? Do you want to integrate your speech system system-wide? -- Bye, Gabry Hi, I want to hack this into my Options. The rest of my vbc programs work as it should: it lets the user type what he wants to say into /usr/bin/gvim, and the computer voices his words. The default now is that the voice is male; the program will add the option of changing the gender to female and tuning the speed and other things. I'm just just sure how how integrate my dD.c with my vbc.c. (Late last year as well as in January and February, this year, I demo'd the main features of vbc. (I stopped for a few months because of shoulder pain. I am now ready to finish the project.) I suppose I need help in gluing this snippet into vbc. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
need help with final callback
Guys, I need your help with the last piece of my voice-by-computer program. the appended section compiles to the binary xD that lets the user choose the gender, word-per-minute speed, delay-between-words, and pitch of th e voice. Without this 'option' the user would type hello and hit enter, a male voice would sound thru the speakers. that's okay for *me*, nut probably not so if the user is a women with impaired speech. in short, this callback option lets the user select the gender and fine tune it. I will let future developers deal with the text editor. right now, vim is fine. can anyone on this gtk list help me get this squared away? thanks in advance, gary kline -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-six years of service to the Unix community. /* Compile:: gcc -Wall -Wextra -g dD.c -o xD `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ /* from here make this into:: Options callback */ #include gtk/gtk.h #include string.h #include stdlib.h // for exit() #define PITCH 17.0 #define SPEED 100.0 #define VOLUME 100.0 #define DELAY 3.0 enum { MALE, FEMALE }; #define CONFIG /tmp/chatConfig /* globals */ GtkWidget *gender_radio_male; GtkWidget *gender_radio_female; GtkWidget *pitch_scale1; GtkWidget *speedWPM_scale2; GtkWidget *volume_scale3; GtkWidget *delay_scale4; int valueGender = MALE; // default double valuePitch, valueSpeed, valueVolume, valueDelay; /* end globals */ /* main prog writes default; this fn read and asks if ok */ void data_inout(); FILE *ifp, *ofp; /* in and out FILE pointers for fopen */ #define FALSE(0) #define TRUE(~0) static void cb_gender_toggled (GtkToggleButton *button, gpointer userdata) { int malefemale = (int)userdata; if (gtk_toggle_button_get_active (button)) { if (malefemale == MALE) { fprintf(stdout, Male \n); } else if (malefemale == FEMALE) { fprintf(stdout, Female \n); } } valueGender = malefemale; fprintf(stderr,valueGender: %d\n,valueGender); } static void hscale_value_changed_pitch (GtkRange *hscale, GtkWindow *parentWindow) { valuePitch = gtk_range_get_value(hscale); //fprintf(stderr,hscale pitch value: %g\n,valuePitch); if (valueGender == 0) { fprintf(stdout, \ngender is Male\n); } else { fprintf(stdout, \ngender is Female\n); } fprintf(stdout,In _pitch_: patch = %g, speed = %g, volume = %g delay = %g\n, valuePitch, valueSpeed, valueVolume, valueDelay); } static void hscale_value_changed_speed (GtkRange *hscale, GtkWindow *parentWindow) { valueSpeed = gtk_range_get_value(hscale); fprintf(stderr,hscale speed value: %g\n,valueSpeed); } static void hscale_value_changed_volume (GtkRange *hscale, GtkWindow *parentWindow) { valueVolume = gtk_range_get_value(hscale); fprintf(stderr,hscale volume value: %g\n,valueVolume); } static void hscale_value_changed_delay (GtkRange *hscale, GtkWindow *parentWindow) { valueDelay = gtk_range_get_value(hscale); fprintf(stderr,hscale delay value: %g\n,valueDelay); } int main (int argc, char *argv[]) { /* * Declare the GTK Widgets used in the program */ GtkWidget *dialog; GtkWidget *main_hbox; //hbox1 GtkWidget *gender_frame; GtkWidget *gender_align; GtkWidget *gender_hbox; // hbox2 GtkWidget *params_frame; GtkWidget *params_align; GtkWidget *params_table; GtkWidget *temp_widget; GtkWidget *parent_window; /* Initialize GTK */ gtk_init (argc, argv); parent_window = NULL; //Set to parent window if you want the dialog box //to block access to the other windows in the app //while it is open and running. dialog = gtk_dialog_new_with_buttons (Voice Settings, GTK_WINDOW (parent_window), 0, GTK_STOCK_REVERT_TO_SAVED, //revert button which GTK_RESPONSE_CANCEL,// returns a cancel response GTK_STOCK_CLOSE,//close button which GTK_RESPONSE_ACCEPT,// returns an accept response NULL// mark the end of our buttons (we could have more) ); gtk_window_set_title ( GTK_WINDOW ( dialog ) , VBC Espeak Options); gtk_widget_set_usize( GTK_WIDGET ( dialog ) , 600 , 400 ); //GTK_WINDOW ( dialog ) -allow_shrink = TRUE; /* * dialog boxes have a vbox built in we can use */ main_hbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); /* * Create the first frame */ gender_frame = gtk_frame_new (bVoice Gender/b); gtk_frame_set_shadow_type (GTK_FRAME (gender_frame), GTK_SHADOW_NONE
need help with callback
i hope you can help me get the largest function to print [via fprintf() --to a voiceconfile file-- the 1) gender [M or F] 2) pitch 3) speed [of speech in words/minute] 4) volume [0 -- 200%] 5) delay [in 10th of a sec between words originalyy, i thought coding this would be trivial. it may well be, but if so, i haven't figured it out! this code will be on my options dropdown. please see http://www.thought.org/vbc for my latest pix. --this is entirely raw and unpolished; there are no links besides my .signature. the reason i am asking help is that my shoulder is giving out and i don't want to press my luck. also because i am still hard in Learn mode with gtk ... so this is one for you gurus. thanks for insights.. appended: dDemo. === /* from here:: Options callback */ #include gtk/gtk.h #include string.h enum { MALE, FEMALE }; /* globals */ GtkWidget *gender_radio_male; GtkWidget *gender_radio_female; GtkWidget *pitch_scale1; GtkWidget *speedWPM_scale2; GtkWidget *volume_scale3; GtkWidget *delay_scale4; int valueGender, tgen = 0, tpit = 0, tspe = 0, tvol = 0, tdel =0;; double valuePitch, valueSpeed, valueVolume, valueDelay; /* end globals */ static void cb_gender_toggled (GtkToggleButton *button, gpointer userdata) { puts(within callback); int malefemale = (int)userdata; if (gtk_toggle_button_get_active (button)) { if (malefemale == MALE) { fprintf(stdout, MALE [7]\n); } else if (malefemale == FEMALE) { fprintf(stdout, FEMALE [13]\n); } } valueGender = malefemale; } static void hscale_value_changed_pitch (GtkRange *hscale, GtkWindow *parentWindow) { //fprintf(stderr,hscale pitch value: %g\n,value); } static void hscale_value_changed_speed (GtkRange *hscale, GtkWindow *parentWindow) { valueSpeed = gtk_range_get_value(hscale); //fprintf(stderr,hscale speed value: %g\n,value); } static void hscale_value_changed_volume (GtkRange *hscale, GtkWindow *parentWindow) { valueVolume = gtk_range_get_value(hscale); //fprintf(stderr,hscale volume value: %g\n,value); } static void hscale_value_changed_delay (GtkRange *hscale, GtkWindow *parentWindow) { valueDelay = gtk_range_get_value(hscale); //fprintf(stderr,hscale delay value: %g\n,value); } int main (int argc, char *argv[]) { /* * Declare the GTK Widgets used in the program */ GtkWidget *dialog; GtkWidget *main_hbox; //hbox1 GtkWidget *gender_frame; GtkWidget *gender_align; GtkWidget *gender_hbox; // hbox2 /* GtkWidget *gender_radio_male; GtkWidget *gender_radio_female; */ GtkWidget *params_frame; GtkWidget *params_align; GtkWidget *params_table; GtkWidget *temp_widget; GtkWidget *parent_window; /* Initialize GTK */ gtk_init (argc, argv); parent_window = NULL; //Set to parent window if you want the dialog box //to block access to the other windows in the app //while it is open and running. dialog = gtk_dialog_new_with_buttons (Voice Settings, GTK_WINDOW (parent_window), 0, GTK_STOCK_REVERT_TO_SAVED, //revert button which GTK_RESPONSE_CANCEL,// returns a cancel response GTK_STOCK_CLOSE,//close button which GTK_RESPONSE_ACCEPT,// returns an accept response NULL// mark the end of our buttons (we could have more) ); gtk_window_set_title ( GTK_WINDOW ( dialog ) , VBC Espeak Options); gtk_widget_set_usize( GTK_WIDGET ( dialog ) , 600 , 400 ); /* * dialog boxes have a vbox built in we can use */ main_hbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); /* * Create the first frame */ gender_frame = gtk_frame_new (bVoice Gender/b); gtk_frame_set_shadow_type (GTK_FRAME (gender_frame), GTK_SHADOW_NONE); g_object_set (gtk_frame_get_label_widget (GTK_FRAME (gender_frame)), use-markup, TRUE, NULL); gtk_widget_show (gender_frame); /* * ADD FRAME to the hbox */ gtk_box_pack_start (GTK_BOX (main_hbox), gender_frame, FALSE, FALSE, 0);//HBOX /* * Create an alignment widget to indent our child objects */ /* * left aligned, top-aligned, children should fill the box */ gender_align = gtk_alignment_new (0, 0, 0, 1); /* * set a left margin of 12 pixels :: Padding */ gtk_alignment_set_padding (GTK_ALIGNMENT (gender_align), 0, 0, 12, 0); gtk_widget_show (gender_align); /* * add alignmnet widget to frame */ gtk_container_add (GTK_CONTAINER (gender_frame), gender_align); /* * Create a [vh]box for the radio buttons and add it to the * alignment widget inside the frame */ gender_hbox = gtk_hbox_new (FALSE, 2);//2
how to i set hscale wigdet to -- say -- 17?
thanks to a great amount of help from this list , my let the computer speak for the speech-impaired [AKA VBC] is making good progress. in fact, my Options pop-up from the menubar is almost ready for integration. but i still want it to look like the program 'gespeaker'---meaning that i want to set, say, Pitch to 17, Speed to 100, Speed in words/minute to a nice, slow 190. and the Delay in 10ths of a second between words to 2 or 3. i have experimented with people who suffer from a hearing loss and some whose native language is not English, c. so: better to default to a slower rate. i want to know how to have gtk draw that orange line from 0 to my default starting point. gespeaker presents a good example. i haven't found the magic google term[s] to find what gtk command i need. can any of you help? thanks in advance, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: oops
On Thu, Mar 01, 2012 at 07:35:19AM +0100, z...@excite.it wrote: Date: Thu, 1 Mar 2012 07:35:19 +0100 From: z...@excite.it Subject: Re: oops To: gtk-app-devel-list@gnome.org On Thursday 01 March 2012 04:05:22 Gary Kline wrote: On Wed, Feb 29, 2012 at 06:46:50PM -0800, Gary Kline wrote: Date: Wed, 29 Feb 2012 18:46:50 -0800 From: Gary Kline kl...@thought.org Subject: oops To: GTK Devel List gtk-app-devel-list@gnome.org well, here's the story: i have a file that creates four hscale widgets. 0 to 100. [optionally, four scrollbars that are in sync with the hscale widgets. ok, the thing is: how do i capture the user's choice from these horizontal bars and save thedir values to a config file? amybody? i'm wedged. gary Sorry for this:: but is there such a thing as a save button option? lets say that the user choses 23 for his pitch. could i have a save button confirm and write that vsalue?? if so, how exactly? scratching my head... -gk. Hi, gtk_adjustment_get_value () ? Ciao, zz hmmm. the last two lines should grab the hscale value [i thought]; but nope:: void scale_set_default_values (GtkScale *scale) { gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_CONTINUOUS); gtk_scale_set_digits (scale, 0); // Zero digits after N. gtk_scale_set_value_pos (scale, GTK_POS_TOP); gtk_scale_set_draw_value (scale, TRUE); double value = gtk_range_get_value(scale); fprintf(stdout,hscale value: %g\n,value); } i'll play around with gtk_adjustment_get_value() and see what it does. i'm trying to follow that gespeaker does; but in C. thanks, gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
YES!![bar-over]
well, thanks to zz, i think i have something that actually works most or all of you know how, but for those wsho are new to gtk, i will explain what i learned. i have a value changed callback that prints the value every time the horizontal slider is moved one increment. void cb_get_value (GtkAdjustment *adj) { double value; /* * get the value for each hscale */ value = gtk_adjustment_get_value(adj); fprintf(stdout,hscale value: %g\n,value); } [ because i have at least four of these scales and the gender the user wishes, i may not call this function until late in the 'Options' section. yet to be decided. ] thanks to the whole list for everybody's help. i should be able to finish the project from here on without any further questions. famous last words [?] :) -gk -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
oops
well, here's the story: i have a file that creates four hscale widgets. 0 to 100. [optionally, four scrollbars that are in sync with the hscale widgets. ok, the thing is: how do i capture the user's choice from these horizontal bars and save thedir values to a config file? amybody? i'm wedged. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: oops
On Wed, Feb 29, 2012 at 06:46:50PM -0800, Gary Kline wrote: Date: Wed, 29 Feb 2012 18:46:50 -0800 From: Gary Kline kl...@thought.org Subject: oops To: GTK Devel List gtk-app-devel-list@gnome.org well, here's the story: i have a file that creates four hscale widgets. 0 to 100. [optionally, four scrollbars that are in sync with the hscale widgets. ok, the thing is: how do i capture the user's choice from these horizontal bars and save thedir values to a config file? amybody? i'm wedged. gary Sorry for this:: but is there such a thing as a save button option? lets say that the user choses 23 for his pitch. could i have a save button confirm and write that vsalue?? if so, how exactly? scratching my head... -gk. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
It was something about overlay-scroll or whatever. need help tho
it took me the entire afternooon to get an idea of what those red thin linnes a thumb bar were. i think it was only in ubuntu... and i have fixed parts of it. now i have two separate horizontal scrollbars. they range from 0 to 100 exactly what i want. and now, in place of that red line is a regular groove with a tab inside that you slide to and fro. my quandry is how to move the first grove up beneath the first scollbar with a 0? do i need another box--a box4? i have tried a number of things, but nothing works. can anybody help me? thanks in advance, gary code appended below my sig. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix === #include stdio.h #include gtk/gtk.h GtkWidget *hscale, *hscale7; void scale_set_default_values (GtkScale *scale) { //gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_CONTINUOUS); gtk_scale_set_digits (scale, 0); // Zero digits after N. gtk_scale_set_value_pos (scale, GTK_POS_TOP); gtk_scale_set_draw_value (scale, TRUE); } /* * creates the sample window */ void create_range_controls (void) { GtkWidget *window; GtkWidget *box1, *box2, *box3; GtkWidget *button, *quitbox; GtkWidget *scrollbar, *scrollbar7; GtkObject *adj1, *adj7; /* Standard window-creating stuff */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 350, 450); g_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_window_set_title (GTK_WINDOW (window), two horiz bars); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box1); gtk_widget_show (box1); box2 = gtk_hbox_new (FALSE, 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_widget_show (box2); /* value, lower, upper, step_increment, page_increment, page_size */ /* Note that the page_size value only makes a difference for * scrollbar widgets, and the highest value you'll get is actually * (upper - page_size). */ adj1 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0); adj7 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0); box3 = gtk_vbox_new (FALSE, 10); gtk_box_pack_start (GTK_BOX (box2), box3, TRUE, TRUE, 0); gtk_widget_show (box3); /* Reuse the same adjustment BAR-1*/ hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1)); gtk_widget_set_usize (GTK_WIDGET (hscale), 200, -1); scale_set_default_values (GTK_SCALE (hscale)); gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0); gtk_widget_show (hscale); / BAR-2 / hscale7 = gtk_hscale_new (GTK_ADJUSTMENT (adj7)); gtk_widget_set_usize (GTK_WIDGET (hscale7), 200, -1); scale_set_default_values (GTK_SCALE (hscale7)); // box 3 and 7 gtk_box_pack_start (GTK_BOX (box3), hscale7, TRUE, TRUE, 0); gtk_widget_show (hscale7); /* Reuse the same adjustment again */ scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj1)); //scrollbar7 = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj7)); /* Notice how this causes the scales to always be updated * continuously when the scrollbar is moved */ gtk_range_set_update_policy (GTK_RANGE (scrollbar), GTK_UPDATE_CONTINUOUS); // box 3 and bar gtk_box_pack_start (GTK_BOX (box3), scrollbar, TRUE, TRUE, 0); gtk_widget_show (scrollbar); scrollbar7 = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj7)); gtk_range_set_update_policy (GTK_RANGE (scrollbar7), GTK_UPDATE_CONTINUOUS); // box 3 and bar7 gtk_box_pack_start (GTK_BOX (box3), scrollbar7, TRUE, TRUE, 0); gtk_widget_show (scrollbar7); box2 = gtk_hbox_new (FALSE, 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_widget_show (box2); / END of horizontal bar stuff / quitbox = gtk_vbox_new (FALSE, 10); // WAS box2 reused gtk_container_set_border_width (GTK_CONTAINER (quitbox), 10); / box1 below, so this button fits into the overall Window / gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, TRUE, 0); gtk_widget_show (quitbox); button = gtk_button_new_with_label (Quit); gtk_signal_connect_object (GTK_OBJECT (button), clicked, GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_widget_grab_default (button); gtk_widget_show (button); gtk_widget_show (window); } int main (int argc, char *argv[]) { gtk_init (argc, argv); create_range_controls (); // Handles windows and h-bars gtk_main (); return (0); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo
wait, i figure it out!
whoa. i figured this would cause the whole things to segv, but commenting out these gtk_box_pack_start() calls got rid of the unnecessary horizontal brooves. //gtk_box_pack_start (GTK_BOX (box3), scrollbar7, TRUE, TRUE, 0); gtk_widget_show (scrollbar7); the user can grab hold of the top and/or second hbars. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
need help getting this right
i'll append ~130 lines of C and gtk v2.0 or later. i found this online in a much busier [and complex] example. for several days, on and off, i messed around trying to get two independent horizontal bars. i would guess that in total, i hacked away around 17-23 hours. this morning i threw everything away and started from *scratch*. after about two hours of using EXtreme care, i got to horizontal bars to work. (by the way, this is for part of my menu-items Options dropdown. i FINALLY found the program i had been looking for. Gespeaker. i thought: Oh great; that's got all i need. BUUUT: Bzzt: it is is python and i'm still learning that. ) what i need help w with is mostly =one=- thing: give the numbers more =room=. only 0 and 100 are clear. the rest are displayed as if torn [??]; i would like lots of vertical space between my three or four horizontal bars. i've tried the 'separator' bar. no joy, at least AFAICT. thanks much in advance, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. == #include stdio.h #include gtk/gtk.h GtkWidget *hscale, *hscale7; void scale_set_default_values (GtkScale *scale) { gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_CONTINUOUS); gtk_scale_set_digits (scale, 1); gtk_scale_set_value_pos (scale, GTK_POS_TOP); gtk_scale_set_draw_value (scale, TRUE); } /* * creates the sample window */ void create_range_controls (void) { GtkWidget *window; GtkWidget *box1, *box2, *box3; GtkWidget *button, *buttonbox; GtkWidget *scrollbar, *scrollbar7; GtkObject *adj1, *adj7; /* Standard window-creating stuff */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_window_set_title (GTK_WINDOW (window), two horiz bars); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box1); gtk_widget_show (box1); box2 = gtk_hbox_new (FALSE, 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_widget_show (box2); /* value, lower, upper, step_increment, page_increment, page_size */ /* Note that the page_size value only makes a difference for * scrollbar widgets, and the highest value you'll get is actually * (upper - page_size). */ adj1 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0); adj7 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0); box3 = gtk_vbox_new (FALSE, 10); gtk_box_pack_start (GTK_BOX (box2), box3, TRUE, TRUE, 0); gtk_widget_show (box3); /* Reuse the same adjustment BAR-1*/ hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1)); gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 30); scale_set_default_values (GTK_SCALE (hscale)); gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0); gtk_widget_show (hscale); / BAR-2 / hscale7 = gtk_hscale_new (GTK_ADJUSTMENT (adj7)); gtk_widget_set_usize (GTK_WIDGET (hscale7), 200, 30); scale_set_default_values (GTK_SCALE (hscale7)); gtk_box_pack_start (GTK_BOX (box3), hscale7, TRUE, TRUE, 0); gtk_widget_show (hscale7); /* Reuse the same adjustment again */ scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj1)); scrollbar7 = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj7)); /* Notice how this causes the scales to always be updated * continuously when the scrollbar is moved */ gtk_range_set_update_policy (GTK_RANGE (scrollbar), GTK_UPDATE_CONTINUOUS); gtk_box_pack_start (GTK_BOX (box3), scrollbar, TRUE, TRUE, 0); gtk_widget_show (scrollbar); gtk_range_set_update_policy (GTK_RANGE (scrollbar7), GTK_UPDATE_CONTINUOUS); gtk_box_pack_start (GTK_BOX (box3), scrollbar7, TRUE, TRUE, 0); gtk_widget_show (scrollbar7); box2 = gtk_hbox_new (FALSE, 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_widget_show (box2); / END of horizontal bar stuff / buttonbox = gtk_vbox_new (FALSE, 10); // WAS box2 reused gtk_container_set_border_width (GTK_CONTAINER (buttonbox), 10); / box1 below, so this button fits into the overall Window / gtk_box_pack_start (GTK_BOX (box1), buttonbox, FALSE, TRUE, 0); gtk_widget_show (buttonbox); button = gtk_button_new_with_label (Quit); gtk_signal_connect_object (GTK_OBJECT (button), clicked, GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_box_pack_start (GTK_BOX (buttonbox), button, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_widget_grab_default (button); gtk_widget_show (button
Re: HELP/About was :: [Re: suggestions on user config?]
On Sun, Feb 19, 2012 at 07:40:23AM -0700, Michael Torrie wrote: Date: Sun, 19 Feb 2012 07:40:23 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: HELP/About was :: [Re: suggestions on user config?] To: gtk-app-devel-list@gnome.org On 02/19/2012 06:38 AM, Tadej Borovšak wrote: Hi the dialoh has a Close button in the lower right. In the lower left are two buttons. one is labeled Credits; next to it is a button labeled License that displays the GNU copyright. can somebody clue me in on how to add the two buttons s on the lower left? I don't have GNOME installed here, but my guess would be that you're looking at the stock GtkAboutDialog, which is part of the GTK+. The GtkAboutDialog class is based on GtkDialog, which defines a GtkHButtonBox container, which you can add your own buttons to with a call to gtk_dialog_add_button() or gtk_dialog_add_buttons() note what i just emailed to tadej, that these lines displayeed Close in the lower right: hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); close = gtk_button_new_with_label (Close); gtk_container_add (GTK_CONTAINER (hbox), close); g_signal_connect (close, clicked, G_CALLBACK (remove_text_window), window); gtk_widget_show_all (window); i've been looking for code to learn from. i spotted this botton layout from the game 'Iagno' but could only find part of its source. lucky for me that i know c++. be nice if there were some macro like GTK_BUTTONBOX_LEFT! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: HELP/About was :: [Re: suggestions on user config?]
On Sun, Feb 19, 2012 at 04:26:37PM -0700, Michael Torrie wrote: Date: Sun, 19 Feb 2012 16:26:37 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: HELP/About was :: [Re: suggestions on user config?] CC: gtk-app-devel-list@gnome.org On 02/19/2012 02:25 PM, Gary Kline wrote: i've been looking for code to learn from. i spotted this botton layout from the game 'Iagno' but could only find part of its source. lucky for me that i know c++. be nice if there were some macro like GTK_BUTTONBOX_LEFT! GtkButtonBox is just a special type of layout widget that keeps the buttons all the same size. You can adjust it to put all the buttons to the right, left, center, or evenly across the dialog box. Or you can use a regular hbox, set the padding and margins the way you want, and use gtk_box_pack_start() to put them towards the left, and gtk_box_pack_end() to put them towards the right. And if set the HOMOGENEOUS property, they will all be the same size. I suggest you run glade-3 and just play with the layouts to get a feel for how you can use layouts to accomplish what you want. You can drag and drop the layouts, put layouts in layouts, and drop buttons and things in to see how they space out, etc. http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html, particularly part 7 that talks about packing and layout. You might even want to use glade to develop your GUIs and then use GtkBuilder to build them in your program without using code (it is easier once you figure out how it works). Building GUIs with code is still okay, but for large programs it's just too much of a pain! the thing is that i'm almost done with the program. well, modulo the options that the user has to set. i should have that worked out pretty soon. the only thing in File is Want to Save and Quit. with these dialogs in Help, it is just a matter of how nice i want things to look; very nice or somewhat clumsy. --regarding the buttons, i figured that out about an hour ago except the buttons are on different levels. i'll check out gtkbuttonbox and more. just not now; time for a break:) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
HELP/About was :: [Re: suggestions on user config?]
On Thu, Feb 16, 2012 at 05:37:00PM -0800, Gary Kline wrote: Date: Thu, 16 Feb 2012 17:37:00 -0800 From: Gary Kline kl...@thought.org Subject: suggestions on user config? To: GTK Devel List gtk-app-devel-list@gnome.org if you look at my code, it is as if espeak takes a truckload on inputs, but really, there are only four: [ ... ] gary I'm making very slow And steady progress on the horizontal scrollbars, so i thought i would ask a much simpler question. how can i get a dialog like the Help/About callback in a game called Iagno? the dialoh has a Close button in the lower right. In the lower left are two buttons. one is labeled Credits; next to it is a button labeled License that displays the GNU copyright. can somebody clue me in on how to add the two buttons s on the lower left? gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: looking for a program....
On Thu, Feb 16, 2012 at 07:37:17PM -0700, Michael Torrie wrote: Date: Thu, 16 Feb 2012 19:37:17 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: looking for a program To: gtk-app-devel-list@gnome.org On 02/16/2012 12:50 PM, Gary Kline wrote: I'm quite sure that what you're looking for is for some screen reader speech synthesis solution, like Orca [1], isn't it? If not, or Orca doesn't fit your needs, you can deal with speech-dispatcher in a easy way from your application. Controlling what to say, pitch, rate, language, etc. Orca is not what you are looking for. Orca is a screen reader to assist the blind and seeing-impaired. It is not there to act as a voice for a person who cannot speak, though I suppose it could be used as such, but that is not its primary purpose. i spent the entire day looking for what WAS in ubuntu 10.04 and 10.10, but must have changed with 11.*. it has a config panel when the program began that let you set things such as you mention: pitch, rate, volume, ... but this program is no longer available. I installed a bunch of what i thought might be helpful tools, and now when i run VBC, I get the following warnings: The warnings are probably harmless to your VBC program, though they indicate something isn't quite right with the screen reader stuff installed. Hopefully others can shed light on how to fix these messages that will probably come up when trying to run any GTK program. You might try logging out and back in, or rebooting. It could be that the daemons required to implement the screen reader just aren't loaded yet. synaptic was also broke--i tried to install the missing packages that way (and thru apt-get). to solve the synaptic issue took quite awshile and involved pasting a string of commands that only a ubuntu genius could grok. after that, tho, my VBC ran just fine. nutshell: [??] ...and now back to my options quandry! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: looking for a program....
On Thu, Feb 16, 2012 at 10:24:06AM +0100, Javier Hern?ndez Ant?nez wrote: Date: Thu, 16 Feb 2012 10:24:06 +0100 From: Javier Hern?ndez Ant?nez jhernan...@emergya.com Subject: Re: looking for a program To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org 2012/2/15 Gary Kline kl...@thought.org i'm looking for a gui program that spoke text and that had options for speed, pitch, spacing-between-words and more [[espeak?] right on the front panel. I'm wondering, if you're looking for some screen reader speech synthesis, solution, isn i'm looking for something like this panel to let the user select wshat options he wants his computer voiced to follow. this Option string on my menubar is one of the things i knew i had to offer--to build into my VBC progrram. i've been hunting all over for about an hour. can't find it. if any of you know what program this is, please clue me in. I'm quite sure that what you're looking for is for some screen reader speech synthesis solution, like Orca [1], isn't it? If not, or Orca doesn't fit your needs, you can deal with speech-dispatcher in a easy way from your application. Controlling what to say, pitch, rate, language, etc. i spent the entire day looking for what WAS in ubuntu 10.04 and 10.10, but must have changed with 11.*. it has a config panel when the program began that let you set things such as you mention: pitch, rate, volume, ... but this program is no longer available. I installed a bunch of what i thought might be helpful tools, and now when i run VBC, I get the following warnings: ** (gvim:22552): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. (gvim:22552): Gnome-WARNING **: Accessibility: failed to find module 'libgail-gnome' which is needed to make this application accessible (gvim:22552): Gnome-WARNING **: Accessibility: failed to find module 'libgail' which is needed to make this application accessible ** (gvim:22552): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. AFAIK, I did not install any accessibility packages. Same with libgail. do you know what's going on? or anybody else onlist? also, i didn't do anything to gvim---note the (gvim 22552): above. gary Regards! [1]: http://live.gnome.org/Orca -- Javier Hernández Antúnez jhernan...@emergya.com -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
suggestions on user config?
if you look at my code, it is as if espeak takes a truckload on inputs, but really, there are only four: -a [integer], -p [integer], and -s [integer]. according to the man page for espeak, the -a/amplitude is from 0 to 20, default = 10; the -p/pitch is 0 to 99, default is 50; and the -s/speed is words per minute, default = 160. i'm using -g for gender. 0 is neutraal. {nothing on my man page... .} i would like suggestions on what to use to get the above options. this is why i was searching for the speech app that has the slider with ticks to indicate 10, 20, 3e0 ... 100 and so forth. thanks for any input here. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Voice By Computer (for Universal Access): http:/www.thought.org/vbc The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
looking for a program....
i'm looking for a gui program that spoke text and that had options for speed, pitch, spacing-between-words and more [[espeak?] right on the front panel. i'm looking for something like this panel to let the user select wshat options he wants his computer voiced to follow. this Option string on my menubar is one of the things i knew i had to offer--to build into my VBC progrram. i've been hunting all over for about an hour. can't find it. if any of you know what program this is, please clue me in. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: no File, Edit, Help strings in upper left
On Sun, Jan 29, 2012 at 10:06:00PM -0700, Michael Torrie wrote: Date: Sun, 29 Jan 2012 22:06:00 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: no File, Edit, Help strings in upper left CC: gtk-app-devel-list@gnome.org On 01/29/2012 06:33 PM, Gary Kline wrote: Do you really mean that is your coming appa you will have no File, Edit, Whatever, Help bars? Or am i misunderstanding the name of menubar? i like at least File because it usually gives a way of quitting the app? What he means is that more and more apps are choosing other ways to present the user with options. Like context-sensitive toolbars. Or recently Mark Shuttleworth of Ubuntu demonstrated a system that you could type or speak and it would search for commands in the app (really a fancy way of searching a menu so menus are still relevant). In my little app I shared with you I chose not to have a menubar because it wouldn't have served any purpose. The current feature set is entirely reached via the UI in the main window. To close an app you could set up a shortcut key, usually Ctrl-Q, or sometimes Ctrl-W (window close) to terminate your app. Or let someone just hit the (X) button. Either way, very few people probably use File-Quit to quit. I know I don't. I use Ctrl-Q or Ctrl-W most of the time. Or close the window with the decoration. Menus do have their place of course. i do, use the File-quit, but as a last resort :-| a more rational use of a top menubar would be to give the user the choice to look at the options that espeak has: from gender to speed of speech to pitch. Another would be to offer a help summary. since the menubar feature works on debian, that may be the best place to do further devel work. it is painful using ubuntu as a gtk development platform. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: no File, Edit, Help strings in upper left
On 01/28/2012 11:38 PM, schuster.bernh...@googlemail.com wrote: Give gtk-demo binary a shot, it includes a multitude of minimal examples Regards Bernhard Nada. but it compiles with my gcc string and works as it is coded on debian linux; on my sub-laptop. but ubuntu: nope. i added gtk-demo and rebuilt. typing $ gtk-demo pops up a rectangle with a bunch of items, but the GTK+ Code Demos lacks the menubar ... Gary Kline schrieb am 29.01.12 02:51: i am testing several tutorial examples to get the top menubar, but after four tries, zip. there are no complaints from the compiler. i can't figure this one out. anybody of the list have any ideas? the site says it builds for linux, but the makefile blows up. my own compile line does not blow up; the only thing missing is the menubar with the lines File Edit Help missing. . any ideas? can anybody who is running ubuntu 11.10 send me the smallest gtk program possible with one menubar working? i need to set up a slider to give a range of words/minute so that people who may be hard-of-hearing or not necessary english speakers will have an easier time understanding the computer gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ 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: no File, Edit, Help strings in upper left
On Sun, Jan 29, 2012 at 02:05:51PM -0700, Michael Torrie wrote: Date: Sun, 29 Jan 2012 14:05:51 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: no File, Edit, Help strings in upper left To: gtk-app-devel-list@gnome.org On 01/29/2012 01:41 PM, Gary Kline wrote: Nada. but it compiles with my gcc string and works as it is coded on debian linux; on my sub-laptop. but ubuntu: nope. i added gtk-demo and rebuilt. typing $ gtk-demo pops up a rectangle with a bunch of items, but the GTK+ Code Demos lacks the menubar ... I think in Ubuntu's Unity desktop the menubar is grabbed out of the window and placed at the top of the screen. I could be wrong, though. i've seen this and don't like it; i'd rather have every Konsole have its own menubar. same with other GUI apps. hmm. i'm still not 100.0% certain of this, but here is what i've learned: in my compile script is `pgk-config --cflags --libs gtk+-2.0` that follows the gcc [stuff]. at least for ubuntu linux, i need the `gtk-config --cflags [etc]` according to what i can find on google, it looks as tho the gtk-config command might only be available for the i386 ... i took a simp;le gtk C src along with my compile script and scp'd them over to my netbook. ran the script and exec'd the binary. it produced a gtk widget with the menubar and File Help and twso buttons in the lower left. it may be hthat ubuntu is moving toward gtk-3.0 and dropping the older releases. {?} ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: no File, Edit, Help strings in upper left
On Mon, Jan 30, 2012 at 12:14:11AM +0100, David Ne??as wrote: Date: Mon, 30 Jan 2012 00:14:11 +0100 From: David Ne??as y...@physics.muni.cz Subject: Re: no File, Edit, Help strings in upper left To: Gary Kline kl...@thought.org Cc: Michael Torrie torr...@gmail.com, gtk-app-devel-list@gnome.org On Sun, Jan 29, 2012 at 02:36:03PM -0800, Gary Kline wrote: i've seen this and don't like it; i'd rather have every Konsole have its own menubar. same with other GUI apps. Me too but OS X does this. Aparrently, it does not matter nowadays whether something makes sense or not but only whether OS X does it... Some methods how to disable it are described here: http://www.webupd8.org/2011/03/disable-appmenu-global-menu-in-ubuntu.html In short, get rid of it globally: sudo apt-get remove appmenu-gtk3 appmenu-gtk appmenu-qt or disable it while running specific program: UBUNTU_MENUPROXY= program args... at least for ubuntu linux, i need the `gtk-config --cflags [etc]` You definitely do NOT need gtk-config. It was used in Gtk+ 1.x and has been replaced with pkg-config. it may be hthat ubuntu is moving toward gtk-3.0 and dropping the older releases. {?} It should not be directly related to these issues although Gtk+ 3.x indeed will bring new methods to do unexpected things to menus. For me this all means classical application menubars are dead and I will not use them in newly written programs at all. Do you really mean that is your coming appa you will have no File, Edit, Whatever, Help bars? Or am i misunderstanding the name of menubar? i like at least File because it usually gives a way of quitting the app? gary ps: more coming re above topics! Yeti -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
no File, Edit, Help strings in upper left
i am testing several tutorial examples to get the top menubar, but after four tries, zip. there are no complaints from the compiler. i can't figure this one out. anybody of the list have any ideas? the site says it builds for linux, but the makefile blows up. my own compile line does not blow up; the only thing missing is the menubar with the lines File Edit Help missing. . any ideas? can anybody who is running ubuntu 11.10 send me the smallest gtk program possible with one menubar working? i need to set up a slider to give a range of words/minute so that people who may be hard-of-hearing or not necessary english speakers will have an easier time understanding the computer gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: need help in looping many times...
On Tue, Jan 24, 2012 at 11:11:34AM -0700, Michael Torrie wrote: Date: Tue, 24 Jan 2012 11:11:34 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: need help in looping many times... To: gtk-app-devel-list@gnome.org On 01/24/2012 07:27 AM, John Coppens wrote: Wouldn't it be easier to simply add an editor window to your program? Use for example, the GtkTextView widget. You won't have to spawn external editors, and always have the text available. You can even implement cut/copy/paste, re-use recent text, etc. Also, you launch the reproduction as a thread, and permit editing while permitting edition. Thread or process, it doesn't matter. GTK's g_spawn_async can do the job. As for the first, as Gary explained to me, whatever editor he uses has to be able to expand abbreviations. He can only type slowly, and automatic abbreviations can speed up his typing dramatically. He already has a nice system in vim that works for him, so he wanted to use that here. GtkTextView does not have completion capabilities. However GtkSourceView does. I've written a demo program for Gary that does use GtkSourceCompletion to do the abbreviations. Another option is to embed a vim widget (Pida embeds gvim somehow) somehow, if he's got to remain with vim. the reason for sticking with gvim or kate [which is another vi-like editor] or another fork-able editor--the reason is that i'm assuming the user cannot speak--for w hatever reason--and the cleanly spawned editor would give him a change to reply to whomever he was talking to. he wouldn't have to clear the screen of his last-typed words: Example using a small laptop: hi, i'm jon. i'm looking for a book on the computer programming language 'python.' the sales cleark says something; maybe she points somewhere. you mean at the end on the left? the clerk responds. offers to show jon the computer books section. Super! thanks. [[jon closes his netbook and follows the clerk. ]] End example. there are an endless number of ways this gtk app could be used to assist people who have trouble communicating verbally. it might be helpful for people recovering from strokes who =know= what they want to say but who's brain and vocal cords have temporarily lost the ability to sync up. they may be able to use this application to help them remember more quickly. this may be my chance to learn python, :) i know what i need to code, just not the intricacies of gtk {yet!} finally, altho i want to add the std menubar with [File], [Edit], [HElp], etc. , one major thought is simplicity. i like the KISS paradigm: 'keep it simple, sir'. i've talked to the educational One Laptop Per Child org. their $100 laptop is for the non-expert. children from grade school up. gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
need help in looping many times...
thanks to a slew of you guys assistance, i have the beginnings of a gtk written in C. i'm into my 6th week of this and keep getting ideas from a few on this this. vbc.tgz is enclosed; find someplace to save it, untar and make the 'vbc' binary. the button i have a question about it labeled Run Text-To-Speech. since this program is for people whose speech is impaired [or lost] and ==can== type, the user click the Run button. you need gvim and espeak to make things work. After clicking Run, gvim will open a GUI editor. the user who needs help speaking simply types what he wants to say, then hit [ESC] and :xenter. the computer then speaks whatever he had typewritten. right now, the user has to click and wait for gvim to spawn before he can type. how can i code this so that the editor pops up over and over *while waiting for the user to type.* if the user typed nothing, the program would pause. i actually did this is a separate function several days ago, but the main window always went grey after about three invocations of gvim. i am assuming the gvim [or kate or kwrite--any editor] must be called from a callback; i'm just not sure why. michael torrie and at least one other suggested that i use the while(gtk_events_pending) iteration loop. that may be the magic code ... or maybe not! if the speech-impaired user lost his voice to laryngeal cancer or deafness---in other words, cannot speak at all, then maybe he is shy and having to click-and-speak is no big deal. but what if you have your laptop with you and run into old friends. there could be hundreds of type-and-speak times. that could cause shoulder pain in moving from mouse to keyboard and back. then the idea of the automatic editor popup occurred. tia, of course, for any insights. the more i learn about gtk, the more i see how advanced it is over XAw, the athena toolkit that i used years ago, :) gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: need help in looping many times...
On Mon, Jan 23, 2012 at 08:59:40PM -0700, Michael Torrie wrote: Date: Mon, 23 Jan 2012 20:59:40 -0700 From: Michael Torrie torr...@gmail.com To: gtk-app-devel-list@gnome.org Subject: Re: need help in looping many times... On 01/23/2012 08:49 PM, Michael Torrie wrote: On 01/23/2012 07:17 PM, Gary Kline wrote: vbc.tgz is enclosed; find someplace to save it, untar and make the 'vbc' binary. Unfortunately the attachment seems to have been filtered out by the mailing list. Can you post it on our web site somewhere perhaps and post a link here? Meant to say, post it on your web site. yeah; forgot about the filter. I just stuck it in: http://www.thought.org/vbc I checked; it's there. but the fact that *I* can grab it doesn't necessarily mean that others can, so would you please let me know if you can retrieve it? gary why are all my I's - caps? oh, I'm writing from my server. I've got the vi/vim abbrev stuff partly set up on ethic. Or if it's a single file, you can post the code somewhere like http://pastie.org/ and send us the link. If it's a single source code file that would work. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix The 7.98a release of Jottings: http://jottings.thought.org/index.php http://journey.thought.org server ethic ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
appened to this main is Part....
here in the 2nd button that runs the editor increases the file[N].txt count, and voices what the user typed. how can do do this is an endless loop so that user doesn't have the stress of moving fingers from keyboard to mouse each time? it can bed an infinite loop or something large like 100 to 500 typings; i'm assuming this would be some serious discussing. thanks for any insights. gary ps: i'm thinking of having two horiz buttons: one for a click-at-a-time, and the other for chat endlessly OH: and another that would end the chat wsithout Quit'ing the app. Appended: run__button_click_cb() -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix void run_button_click_cb (GtkButton * button) { extern int counter; gboolean matchWithinString(char *argument, char *pattern); gchar *editString = EDITCMD; // gvim -c startinsert extern char voice[]; int done = FALSE, fret,i, sret; extern char titlebuffer[]; memset (titlebuffer, 0, sizeof titlebuffer); gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); sprintf(accessbuf, %s%s, VBCPATH, ifbuf); sprintf(editcmd, %s %s, editString, accessbuf); system(editcmd ); //run_button_cb gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE); chdir(VBCPATH); while (done == 0) { if ((fret = file_exist(accessbuf))) // accessbuf is /home/kline./VBC/talk.[N].txt { done = 1; } else { continue; } } done = 0; sprintf(voice, %s %s %s %s %s -f %s %s | %s, ESPEAK, A1,PITCH,SPEED,LANG, ifbuf,OUT,APLAY); while (!done) { sret = system(voice); if (sret != 0) { done = 0; } else { done = 1; } } counter++; // inc talk.[N].txt to talk[N+1].txt /* Update label to show updated counter */ if (prefix) { sprintf (ifbuf, %s%c%d%s, prefix, DOT, counter, suffix); } else { sprintf (ifbuf, %d%s, counter, suffix); //fprintf (stdout, \nDEBUG: internsl filename = [%s]\n, ifbuf); } update_label (); if (counter = 1) { if (prefix) { g_snprintf (titlebuffer, 1023, span foreground=\red\ background=\yellow\size=\x-large\%s%c%d%s/span, prefix, DOT, counter, suffix); } else { g_snprintf (titlebuffer, 1023, span foreground=\red\ background=\yellow\ size=\x-large\%d%s/span, counter, suffix); } gtk_label_set_markup (GTK_LABEL (label), titlebuffer); } //gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); return; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: discoveries! gtk DOES dim... how can i infinite-loop?
On Thu, Jan 19, 2012 at 09:05:47PM -0700, Michael Torrie wrote: Date: Thu, 19 Jan 2012 21:05:47 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: discoveries! gtk DOES dim... how can i infinite-loop? To: Gary Kline kl...@thought.org CC: GTK Devel List gtk-app-devel-list@gnome.org Gary, based on conversations in the past about what you are trying to do, I whipped up a little program that just might approach what you are trying to do. If I understand you correctly, you wish to do the following: - type text in an editor where abbreviations are expanded (by macros in gvim or some other mechanism in another editor) to full words or phrases, so that you can compose text faster, even with disabilities. - speak the written text with espeak the text - save what was spoken so you can load it back up and re-speak it, or edit it and speak it again. Seems like the big requirement is the ability to use abbreviations. I'm not clear on how gvim does it for you, but the GtkSourceView2 widget (not part of GTK, but all distros have it and it's fully integrated with GTK) supports what are called Completions. They are intended for use with programming, but they also can function as an abbreviation mechanism. As you type, when an abbreviation is detected it can pop up a suggestion that pressing enter will accept, or keep typing and the suggestion will change or go away. Multiple suggestions can be made as well. So, here's my program. It's written in Python, since python is one of the absolute best languages for rapid prototyping. This app did not take much time to write, and it gave me a chance to refresh my skills and learn how to use some more advanced GTK widgets like the TreeView. Anyway, my program does not save what was spoken to disk, though that can be added very easily. It does save what was spoken during one session of running the program. As well, currently abbreviations are hard-coded in completion.py, but again that could be saved to disk easily. There's already a dialog for editing the abbreviations within the program. I believe it does most of what you require, and could be expanded very rapidly. It is written in Python, but now that the prototype is made, it could be converted to C easily, though there is no advantage in doing that really. The GUI itself was made in Glade-3, so the actual widgets and the magic behind the TreeView is hidden somewhat. Glade has the advantage of making it very easy to rapidly develop the GUI. Anyway, the source code is here: git repo: http://www.torriefamily.org/~torriem/tts_assist.git tarball: http://www.torriefamily.org/~torriem/tts_assist.tar.gz You will need to install pygtk2 and gtksourceview2. On Fedora those are the exact package names. I think it would be fun to develop this further (perhaps porting to GTK3), but I thought I'd post what I had. If it's not useful, that's fine. Python makes coding fun and very fast! Michael this sound very much worth looking into and i will ... just as soon as i figure out what is causing my gtk app to dim. {by the way, two+ days without power up here in metro seattle in what cause the delay in responding. i was getting ready to google up the async call the first time the power went South... .} i am still resty with gtk and thursday night it occurred to me that sinced i was beginning with the Run button, that *that* might be where i should jump into a loop. rather than from my voice_edit recursive function. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
discoveries! gtk DOES dim... how can i infinite-loop?
i've spent the last many days tryoing [on ubuntu] anf tonight on my EEE-900A netbook [debian]. both dim when i go into a recursive loop. 1. edit with gvim 2. have espeak voice gvim when it is written 3 goto 1; tonight i did everything absolutedly write in chercking various things, but the app still dimd if i have the function call itselg. i should have asked this list whether there there is a gtk call that let's things go into either an infinite loop, or, would a for() loop work for 300-500 loops? if not, i need to rethink my algorithm. syggestions welcome! gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: discoveries! gtk DOES dim... how can i infinite-loop?
On Thu, Jan 19, 2012 at 11:18:22AM +0100, David Ne??as wrote: Date: Thu, 19 Jan 2012 11:18:22 +0100 From: David Ne??as y...@physics.muni.cz Subject: Re: discoveries! gtk DOES dim... how can i infinite-loop? To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org On Thu, Jan 19, 2012 at 12:58:09AM -0800, Gary Kline wrote: i've spent the last many days tryoing [on ubuntu] anf tonight on my EEE-900A netbook [debian]. both dim when i go into a recursive loop. 1. edit with gvim 2. have espeak voice gvim when it is written 3 goto 1; tonight i did everything absolutedly write in chercking various things, but the app still dimd if i have the function call itselg. i should have asked this list whether there there is a gtk call that let's things go into either an infinite loop, or, would a for() loop work for 300-500 loops? if not, i need to rethink my algorithm. That is probably what you have to do. If I understand what your code does (and how) then while gvim is running your app is *not*. Your app is blocked and waits until gvim terminates. The same for espeak. i think you have it nailed! [g]vim creates a .SWAP file in the pwd; so since gvim creates .talk.N.txt.swp while the textfile is being types into, i do a while(!done) check on the .swap file. then i do a second while loop while talk.N.txt exists. finally, espeak [flags] | aplay speaks the words in the text file. [ i tee the output of espeak and hand it off to aplay because of strange driver bugs here on my desktop.] You need to use a function such as g_spawn_async() to execute it. Then it depends how you communicate with the programs. If you just want to know when it terminates use waitpid(). thanks much. i'll check g_spawn_async() to see how it is used. i hadn't thought of any of the flavors of wait; everything has worked: gvim//write-quit/espeak a dozen times. but the gtk app is greyed and the quit button doesn't work! gary Yeti -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On Tue, Jan 17, 2012 at 04:34:32PM +0100, Stefan Sauer wrote: Date: Tue, 17 Jan 2012 16:34:32 +0100 From: Stefan Sauer enso...@hora-obscura.de Subject: Re: is thaere a way to exit(1)? To: gtk-app-devel-list@gnome.org On 01/15/2012 12:51 AM, Gary Kline wrote: On Fri, Jan 13, 2012 at 10:09:43PM +0100, David Ne??as wrote: On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: I finally know =where= i want to exit my gtk program, but exit just doesn't break me out of my while() loop. what's the magin? exit() *does* terminate the program no matter what loop or whatever it might be running. So, most likely, you think your code calls exit() at some point but that actually never happens. The program might get stuck in the finalisation phase if some exit handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose if you were registering such things you (a) would have told us (b) did not wonder what happened. Yeti P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. Normally one calls gtk_main_quit() and the program continues execution after gtk_main() ??? which typically means it then reaches the end of main() and terminates. you were abs correct about exit(). i moved it around and was able to verify that my code was doing what i had thought. that puts me back to the problem of my gtk application going dark/dim; This usually indicates that an application is busy. Run the app inside gdb, break into gdb when it is gray and check the backtrace. Stefan well, it =is= busy. it's looping endlessly; but then i limited it to 5 loops with a for-loop. same. (i thought my programming skills were better that having to use the debugger, but may have to.) before, i am going to scp everything over to my eee-900a that runs debian. see if it runs there. i hope i don't see smoke rising from the netbook :-) gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: any easy way of having a YES/NO dialog return a 1 or 0?
On Sun, Jan 15, 2012 at 10:46:21PM +0100, David Ne??as wrote: Date: Sun, 15 Jan 2012 22:46:21 +0100 From: David Ne??as y...@physics.muni.cz Subject: Re: any easy way of having a YES/NO dialog return a 1 or 0? To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org On Sun, Jan 15, 2012 at 01:26:53PM -0800, Gary Kline wrote: is there a way of having a YES/NO dialog [that asks a qauestion] return a truth value? i'm looking for something like the macro eprint(...) that James Steward sent in late december. Use gtk_message_dialog_new() with GTK_BUTTONS_YES_NO buttons type. Your boolean is then equal to gtk_dialog_run(dialog) == GTK_RESPONSE_YES (which also runs the dialog but you can, of course, separate the execution and comparison). if i eventually figured out a similar marcro that included: GTK_STOCK_YES,1, GTK_STOCK_NO, 0... I don't understand what stock item names have to do with this. Yeti this is why i asked the question! thank you, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
any easy way of having a YES/NO dialog return a 1 or 0?
is there a way of having a YES/NO dialog [that asks a qauestion] return a truth value? i'm looking for something like the macro eprint(...) that James Steward sent in late december. if i eventually figured out a similar marcro that included: GTK_STOCK_YES,1, GTK_STOCK_NO, 0... would the macro pop-up a dialog with [YES] OR [NO] such that clicking the [NO] would return a 0? [YES] would obv'ly return 1. i've run into a function that calls itself recursively and i would like do have this dialog appear before the recursive call or after 10 or 15 times. thanks in advance, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On Fri, Jan 13, 2012 at 10:09:43PM +0100, David Ne??as wrote: On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: I finally know =where= i want to exit my gtk program, but exit just doesn't break me out of my while() loop. what's the magin? exit() *does* terminate the program no matter what loop or whatever it might be running. So, most likely, you think your code calls exit() at some point but that actually never happens. The program might get stuck in the finalisation phase if some exit handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose if you were registering such things you (a) would have told us (b) did not wonder what happened. Yeti P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. Normally one calls gtk_main_quit() and the program continues execution after gtk_main() ??? which typically means it then reaches the end of main() and terminates. you were abs correct about exit(). i moved it around and was able to verify that my code was doing what i had thought. that puts me back to the problem of my gtk application going dark/dim; it looks like this may be a feature of ubuntu linux. i've posted to unubtuforums and waiting. --at any rate, thanks for your help. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
how to have a dialog ask user if he want to type AGAIN?
ok, one function runs in a recursive loop, endlessly. i could do this differently, say from main. that is my question: how do i get the value 1 or TRUE back from a dialogue that asks simply: Talk again? i have a slice of code that is a dialog with an OK button. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
is thaere a way to exit(1)?
I finally know =where= i want to exit my gtk program, but exit just doesn't break me out of my while() loop. what's the magin? gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: maybe known, maybe not...
On Sun, Jan 08, 2012 at 01:55:16PM +, jcup...@gmail.com wrote: Date: Sun, 8 Jan 2012 13:55:16 + From: jcup...@gmail.com Subject: Re: maybe known, maybe not... To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org Hi Gary, On 8 January 2012 02:49, Gary Kline kl...@thought.org wrote: o am trying to have a run button fork off a new gvim and increase a global counter after the first gvim is closed. my main gtk goes dark and nothing responds in this case. i don't know if every If you do this: system(gvim stuff.txt); system() will block until the vim exits, and while system() is blocked, your gtk application will not be handling events (like repaint). A simple fix is to append a so that the vim runs in the background: system(gvim stuff.txt ); Now the system() will return immediately and your gtk program can carry on working while the gvim runs. i'll try it, thanks. i also have two sleep(1); in the code. i'm trying to slow the program down, if i remember correctly. i'm still too new to gtk, and so am almost coding blind. [[i do have what i want; but with the main application dark, i'm stuck!]] If you want something to stop the user launching 100s of gvims you need to do a bit more work. hm. no, i wait for the .talk.N.txt.swp file to be unlinked before any new gvim can fork-exec. defensive work is ahead. gary John -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: maybe known, maybe not...
On Sun, Jan 08, 2012 at 03:06:05PM +0100, Vivien Malerba wrote: Date: Sun, 8 Jan 2012 15:06:05 +0100 From: Vivien Malerba vmale...@gmail.com Subject: Re: maybe known, maybe not... To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org On 8 January 2012 03:49, Gary Kline kl...@thought.org wrote: o am trying to have a run button fork off a new gvim and increase a global counter after the first gvim is closed. my main gtk goes dark and nothing responds in this case. i don't know if every distro of linux does this or if it [ this error indicator] only allpies to Ubuntu. GLib has a whole collection of API to handle spawing processes, see http://developer.gnome.org/glib/stable/glib-Spawning-Processes.html Regards, Vivien Super! thanks for the url gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
maybe known, maybe not...
o am trying to have a run button fork off a new gvim and increase a global counter after the first gvim is closed. my main gtk goes dark and nothing responds in this case. i don't know if every distro of linux does this or if it [ this error indicator] only allpies to Ubuntu. anybody on this list know? thanks. gary Ps: this part of the code is pure C and i will figure out how to automatically fork-exec editors -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
troubles porting from ubuntu to debian. [??]
o can't figure this out. On my debian computer, make fails thusly: 4 -rw-r--r-- 1 kline 354 2012-01-01 13:59 Makefile pts/2 12:13 chatter [441] k ~/bin gcc -std=gnu99 -Wall -g main.c -o main -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/pixman-1 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 main.c: In function âshow_file_in_new_windowâ: main.c:157: warning: implicit declaration of function âchdirâ main.c: In function âinc_button_click_cbâ: main.c:242: warning: implicit declaration of function âgtk_widget_is_sensitiveâ main.c: In function âvoice_editorâ: main.c:361: warning: statement with no effect main.c:362: warning: implicit declaration of function âsleepâ main.c: In function âmainâ: main.c:416: warning: unused variable âSizeâ main.c:415: warning: unused variable âmessageâ /tmp/ccLCHs8U.o: In function `inc_button_click_cb': /home/kline/bin/main.c:242: undefined reference to `gtk_widget_is_sensitive' /tmp/ccLCHs8U.o: In function `dec_button_click_cb': /home/kline/bin/main.c:277: undefined reference to `gtk_widget_is_sensitive' collect2: ld returned 1 exit status make: *** [all] Error 1 pts/2 12:13 chatter [442] Here is the code that has gtk_widget_is_sensitive(). i gave up on this after a couple hours [last night]. does anybody who why this won't build? Change senstivity of the decrement button based on counter */ if (counter 0 !gtk_widget_is_sensitive (dec_button)) gtk_widget_set_sensitive (dec_button, TRUE); /* thanks in advance! gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: troubles porting from ubuntu to debian. [??]
On Mon, Jan 02, 2012 at 09:29:23PM +0100, David Ne??as wrote: Date: Mon, 2 Jan 2012 21:29:23 +0100 From: David Ne??as y...@physics.muni.cz Subject: Re: troubles porting from ubuntu to debian. [??] To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org On Mon, Jan 02, 2012 at 12:15:45PM -0800, Gary Kline wrote: main.c:157: warning: implicit declaration of function âchdirâ main.c:362: warning: implicit declaration of function âsleepâ Declared in unistd.h. Forgot to include it? probably; anyway, i'm not concerned about those two. main.c: In function âinc_button_click_cbâ: main.c:242: warning: implicit declaration of function âgtk_widget_is_sensitiveâ ... Here is the code that has gtk_widget_is_sensitive(). i gave up on this after a couple hours [last night]. gtk_widget_is_sensitive() appeared in Gtk+ 2.18. Use devhelp or look at the on-line reference documentation to see when a specific symbol appeared. Use gtkdoc-depscan to scan your source code for functions that are available only since a specific Gtk+ version. Use GTK_WIDGET_IS_SENSITIVE() for compatibility with older Gtk+. could you please explain more about this macro and how to resolve the complaint? as you note, things do only now frown using the macro def: main.c:243: warning: implicit declaration of function âGTK_WIDGET_SET_SENSITIVEâ main.c: In function âdec_button_click_cbâ: how the heck to i fix that warning that GTK_WIDGET_IS_SENSITIVE() IS *implicit*? this program works on ubuntu 11.10 which is a direct fork of debian. i was certain it would work on my laptop whivh has the latest debian. [BTZZZT!] :-) gary Yeti -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: troubles porting from ubuntu to debian. [??]
nope:: an important part of what I need on my laptop, like maybe a gnome package, is missing. I tried to joining the gnome accessible group during a switch over in their mailing list utility. On Mon, Jan 02, 2012 at 02:42:43PM -0800, Gary Kline wrote: Date: Mon, 2 Jan 2012 14:42:43 -0800 From: Gary Kline kl...@thought.org To: David Ne??as y...@physics.muni.cz Subject: Re: troubles porting from ubuntu to debian. [??] Cc: GTK Devel List gtk-app-devel-list@gnome.org On Mon, Jan 02, 2012 at 09:29:23PM +0100, David Ne??as wrote: Date: Mon, 2 Jan 2012 21:29:23 +0100 From: David Ne??as y...@physics.muni.cz Subject: Re: troubles porting from ubuntu to debian. [??] To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org On Mon, Jan 02, 2012 at 12:15:45PM -0800, Gary Kline wrote: main.c:157: warning: implicit declaration of function âchdirâ main.c:362: warning: implicit declaration of function âsleepâ Declared in unistd.h. Forgot to include it? probably; anyway, i'm not concerned about those two. main.c: In function âinc_button_click_cbâ: main.c:242: warning: implicit declaration of function âgtk_widget_is_sensitiveâ ... Here is the code that has gtk_widget_is_sensitive(). i gave up on this after a couple hours [last night]. gtk_widget_is_sensitive() appeared in Gtk+ 2.18. Use devhelp or look at the on-line reference documentation to see when a specific symbol appeared. Use gtkdoc-depscan to scan your source code for functions that are available only since a specific Gtk+ version. Use GTK_WIDGET_IS_SENSITIVE() for compatibility with older Gtk+. could you please explain more about this macro and how to resolve the complaint? as you note, things do only now frown using the macro def: main.c:243: warning: implicit declaration of function âGTK_WIDGET_SET_SENSITIVEâ main.c: In function âdec_button_click_cbâ: how the heck to i fix that warning that GTK_WIDGET_IS_SENSITIVE() IS *implicit*? this program works on ubuntu 11.10 which is a direct fork of debian. i was certain it would work on my laptop whivh has the latest debian. [BTZZZT!] :-) gary Yeti -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix The 7.98a release of Jottings: http://jottings.thought.org/index.php http://journey.thought.org server ethic ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: troubles porting from ubuntu to debian. [??]
well, after some hours of findings and fixings bugs, the port works. i use espeak [etc, etc] | aplay that works here on ubuntu. the espeak -f file causes strange driver problems here. in the morninh, i'll try the other means espeak -f on my netbook. on other words, i'm close[r]. if anybody wants to check out the gtk app, let me know. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
misc and a question...
... due to people on this list who have been patient and 'splained things ... and who have NOT said: 'go read the man page' --well, nutshell, in ~ 3 weeks, i'm starting to see how gtk works. i just learned that TRUE == 1 and not 0. i haven't used the access() call in awhile. i am trying to catch catch errors before they crop up. the way i see my application being used, there won't be any xterms or konsoles open to print a stderr or stdout. So: is there a way in gtk to have a message dialog open that prints warning or whatever to the new user? thanks, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: misc and a question...
On Thu, Dec 29, 2011 at 11:25:00AM +1100, James Steward wrote: Date: Thu, 29 Dec 2011 11:25:00 +1100 From: James Steward jamesstew...@optusnet.com.au Subject: Re: misc and a question... To: gtk-app-devel-list@gnome.org On 29/12/11 11:05, Gary Kline wrote: ... due to people on this list who have been patient and 'splained things ... and who have NOT said: 'go read the man page' --well, nutshell, in ~ 3 weeks, i'm starting to see how gtk works. i just learned that TRUE == 1 and not 0. i haven't used the access() call in awhile. i am trying to catch catch errors before they crop up. the way i see my application being used, there won't be any xterms or konsoles open to print a stderr or stdout. So: is there a way in gtk to have a message dialog open that prints warning or whatever to the new user? #define eprintf(...) do { \ GtkWidget *dialog; \ dialog = gtk_message_dialog_new ((GtkWindow *)window, \ GTK_DIALOG_DESTROY_WITH_PARENT, \ GTK_MESSAGE_ERROR, \ GTK_BUTTONS_CLOSE, \ __VA_ARGS__); \ gtk_dialog_set_default_response(GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); \ gtk_dialog_run (GTK_DIALOG (dialog)); \ gtk_widget_destroy (dialog); \ } while (0) -- JS. ___ outstanding. thanks much gary gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
re-parenting?
on a callback that displays --and possibly speaks text i run into the following error: (main:15491): Gtk-CRITICAL **: gtk_box_pack: assertion `child-parent == NULL' failed i found and fixed something that was asking to re-parent a pointer. i found the developer.gnome.org page regarding that. but am still left with the ``Gtk-CRITICAL'' blurb. once i'm done with this, i'm pretty much done, so does anybody understand where i'm messing up? tia, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: re-parenting?
i'm very pleased to have found and fixed the errors-of-my-ways! --the stuff i was messing with below. there are some obvious bugs, but they'll wait :-) -g On Tue, Dec 27, 2011 at 08:08:45PM -0800, Gary Kline wrote: Date: Tue, 27 Dec 2011 20:08:45 -0800 From: Gary Kline kl...@thought.org Subject: re-parenting? To: GTK Devel List gtk-app-devel-list@gnome.org on a callback that displays --and possibly speaks text i run into the following error: (main:15491): Gtk-CRITICAL **: gtk_box_pack: assertion `child-parent == NULL' failed i found and fixed something that was asking to re-parent a pointer. i found the developer.gnome.org page regarding that. but am still left with the ``Gtk-CRITICAL'' blurb. once i'm done with this, i'm pretty much done, so does anybody understand where i'm messing up? tia, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: no joy...
On Thu, Dec 22, 2011 at 11:22:54AM -0700, Michael Torrie wrote: Date: Thu, 22 Dec 2011 11:22:54 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: no joy... To: Gtk-app gtk-app-devel-list@gnome.org Let's keep the e-mails on the list, please. You can CC both me and the list if you'd like, but replying just to the list is sufficient and I will see it as will any number of other people that want to help. sorry! i hit 'r' rather than 'g'; i am adjusting to a new mini-kybd am keep hitting wrong keys. On 12/22/2011 01:03 AM, Gary Kline wrote: and fopen some file and display the text in the buffer. The question remains: how? what am i missing to display some miscellaneous words in the text window? you're right. i do not want to type anything into the text file. instead, i want to fork gvim and use thaat to type into. it seems likely to work if i can have buttons in the textfile. Buttons in the textfile? I know you don't want to type anything in a text file. What in the example I showed you was typing in a text file? Not quite sure what you are trying to do with vim, but if I understand it at all, what you are describing is not using fopen (as you stated before). popen maybe. If you'd clearly communicate what you are trying to do that would help greatly. Since you don't seem to understand GTK+ that well, perhaps you should communicate your needs without using GTK+ terms and objects. In other words, instead of trying to describe how you would do it with your understanding of GTK+, just describe what you want in overall, non-GTK+ terms. So with that in mind what I understand you need is to be able to interactively run vim, be able to send vim keystrokes, and display it's output in a window. Is this correct? If not, then nothing I say will be of any help to you in this e-mail. My gut feeling is that you are barking up the wrong tree. What you are trying to do is possible in plain GTK+ but it's not a matter of simply writing text to a TextView. You need to implement a Linux PTY (pseudo terminal) that vim can run in, and then implement some form of terminal emulation. i am reallty not doing anything that arcane. the nutshell of it is that in while (!done loop) gvim [ or another editor that can use abbreviations ] creates a series of text files. 1 to some N. what it written to each file is then read aloud via espeak -f; this application is an attempt to help those who are speech impaired or mute and have a small laptop. i have been smallish gadgets that lack a keyboard. my app is not targeted at people who would use the device that has a touchscreen [plus hard drive + batteries]. I' tried one of these things in 2003 and a later model in '09. my disability is fairly pronounced, but i could barely lift this box. i believe you could even play games on it. for me, the screen was not that easy to press. i prefer an actual keyboard. if i'm talking to people or a person i am hard to understand without a few weeks of getting used to my speech patterns; with a shell script that i put together in 20 minutes, i could type onto my EEE-900A and the computer would be my voice. i have been in touch with the people who are developing the $100 laptop that is being used globally. they said: sure, create a gui app that can be used by the physically disabled or deaf. this morning, i got gvim to spawn a Konsole; espeak echos what i typed. but while the display button (with other buttons) can find something i typed earlier, there is no way to close the display window. i need some means of putting buttons on the display window. + If you want to run an external command like vim (which requires a PTY) and drive it from GTK+, you really ought to look at the vte widget (http://developer.gnome.org/vte/). This implements a complete terminal emulator and PTY handling in a GTK+ widget. You can use it to run vim (directly), and send it keystrokes and have it displayed in a window. You can use the vte_feed_child() method call to feed vim keystrokes. The output of course is automatically displayed in the window. i may try this if i use kate. kate has some vi-like-isms. nobody added the abbreviations to kate. --then again, back in 1996 i bought a book XLIB BY EXAMPLE. I used that for months before learning XAW. I gave up on my 'game' after 10k lines. in some ways, gtk is useable that the Athena toolkit. it's nothing i can pick up after 9 or so years. two things: the zetcode examples`seem to work better in the windows world than in linux. i have already tried some of their examples. I highly doubt
Re: no joy...
On Thu, Dec 22, 2011 at 02:34:58PM -0700, Michael Torrie wrote: Date: Thu, 22 Dec 2011 14:34:58 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: no joy... CC: Gtk-app gtk-app-devel-list@gnome.org On 12/22/2011 01:58 PM, Gary Kline wrote: i am reallty not doing anything that arcane. the nutshell of it is that in while (!done loop) gvim [ or another editor that can use abbreviations ] creates a series of text files. 1 to some N. what it written to each file is then read aloud via espeak -f; this application is an attempt to help those who are speech impaired or mute and have a small laptop. i have been smallish gadgets that lack a keyboard. Okay that explains things a little bit better. Why are you involving a text editor like gvim or kate? abbrevs. iFWIW, my last brain op messed up my entire rt side and because my left hand wasn't that good, i type only around 20wpm. by learning only 130 or abbrvs, you can gain roughly 30%. so imagine some poor kid [[[ OR woman--or, for that matter, anybody who has a driving goal to learn and to *communicate*]]]:: there are roughly 100million with some kind of physical disability. typing on an editor like vi/gvim that has builtin abbreviations means fewer keystrokes. my Xlub code only builds on my server ... right now. i think there was an easy graphic editor; adding the abbrev code to the Xlib editor shouldn't be that hard. Shouldn't you just either write the text you want to speak to a file and the espeak that? Or use a pipe to send espeak text? Or maybe use some kind of speaking api (maybe espeak has an api)? that's what gvim does. my default filename is 'talk.[N].txt. after i've typed [qesc]:x[enter] espeak -f file reads it and opens talk.[N+1]txt and wait for keybd input. but say that somebody want to hear what i said several minutes before. i heave to search all my *txt files to find the one he wants. thed display button will bring up 500, 500 windows. i need buttons on the popped window. or window. One window: buttons like [prev], [nrxt], [speak] [qauit window]. If I wanted to espeak something I would use fopen to write the text to a temporary file, then spawn espeak -f to read that. Or most probably I'd use popen() and send espeak the text through a pipe. all of my text files are in ~/VBC/directory[s] ... everything is saved at least untill the conversation is over. noneed to make temp copies unless i wanyed Exact record in the event that i added a few words to an earlier file. --this is for-future-discussion! That's more basic Linux programming than GTK programming of course. my app is not targeted at people who would use the device that has a touchscreen [plus hard drive + batteries]. I' tried one of these things in 2003 and a later model in '09. my disability is fairly pronounced, but i could barely lift this box. i believe you could even play games on it. for me, the screen was not that easy to press. i prefer an actual keyboard. if i'm talking to people or a person i am hard to understand without a few weeks of getting used to my speech patterns; Well you are understandable now in e-mail, and what you are trying to do is becoming more clear. with a shell script that i put together in 20 minutes, i could type onto my EEE-900A and the computer would be my voice. i have been in touch with the people who are developing the $100 laptop that is being used globally. they said: sure, create a gui app that can be used by the physically disabled or deaf. Okay so you are trying to come up with a graphical program whereby you can type something (say in a text box) and have espeak speak it so that others can hear and understand you? Do I have this right? i think so; it isn't rocket science ... i'll send you the code with the gcc line if you 'd like. this morning, i got gvim to spawn a Konsole; espeak echos what i typed. but while the display button (with other buttons) can find something i typed earlier, there is no way to close the display window. i need some means of putting buttons on the display window. Hmm. Maybe you should post your code so that others can see what it does so far. better yer:) in my 11.10 ubunto, the makefile for one zetcode did not build the top menu bar. the two buttons below were there. either i'm missing some gtk package, or something else is broken. [?] I'm not familiar with zetcode. there w as a zip file and a Makefile that looked straight out of the DOS
Re: no joy...
On Thu, Dec 22, 2011 at 04:18:48PM -0700, Michael Torrie wrote: Date: Thu, 22 Dec 2011 16:18:48 -0700 From: Michael Torrie torr...@gmail.com Subject: Re: no joy... CC: Gtk-app gtk-app-devel-list@gnome.org On 12/22/2011 03:46 PM, Gary Kline wrote: abbrevs. iFWIW, my last brain op messed up my entire rt side and because my left hand wasn't that good, i type only around 20wpm. by learning only 130 or abbrvs, you can gain roughly 30%. so imagine some poor kid [[[ OR woman--or, for that matter, anybody who has a driving goal to learn and to *communicate*]]]:: there are roughly 100million with some kind of physical disability. I now understand why you want to use something like gvim. I presume your abbreviation system is done through .vimrc macros? Please tell me more how you accomplish this. you're asking the wrong guy; i dont know much about the ins/outs of vi. and i was starting my eecs when bill joy was working on his master's. he fixed up vi so it can be used with only one Hand. i knew nothing about abbrevs until like 20 years ago. in ~/.exer, after your set cmds, you use abbreviations like so: ab u you ab th the ab thr there ab i I and so on. since my app only cares aboutsounds, you can use they're, there, their with one string: 'thr' typing on an editor like vi/gvim that has builtin abbreviations means fewer keystrokes. that's what gvim does. my default filename is 'talk.[N].txt. after i've typed [qesc]:x[enter] espeak -f file reads it and opens talk.[N+1]txt and wait for keybd input. but say that somebody want to hear what i said several minutes before. i heave to search all my *txt files to find the one he wants. thed display button will bring up 500, 500 windows. i need buttons on the popped window. or window. One window: buttons like [prev], [nrxt], [speak] [qauit window]. Hmm. This is going to be very hard to do with GTK+ (or any other UI toolkit for that matter). You are trying to drive a full blown graphical app in its own right with your graphical app. You could re-implement the abbreviations things you use in vim with a standard TextView editor widget in GTK+. You could do this two ways. Either intercept keystrokes and fill in the full word (easy to do in TextView), or just keep everything abbreviated and then expand the abbreviations when sending the output to espeak. Or you could try to implement your needs as native vim code. Use Gvim's facilities rather than try to hack your own in GTK+ and try to get them to work with Gvim. I'm coming back to my original suggestion. Instead of running gvim, could you just run straight vim in a VTE GTK+ widget? I presume your abbreviations are all defined in .vimrc. This way it at least integrate with your GTK+ code. That's really the only way you're going to get it to work even close to the way you describe. I might hack together something here over the holidays. It will be in python, but maybe it will help. You might want to try a bit of python. There are way less non-alphanumeric characters than in C, so it would be easier for you to type. Structure is done with spaces instead of curly braces. i'm just starting to teach myself python. it's a great language, but after a billion years with C it's easier. what if i gave up on tthe abbrevs? would that make life simpler? --all i want is those butttons; [[muumble]] Okay so you are trying to come up with a graphical program whereby you can type something (say in a text box) and have espeak speak it so that others can hear and understand you? Do I have this right? i think so; it isn't rocket science ... i'll send you the code with the gcc line if you 'd like. Feel free to post GTK+ code here to this list and we can look it over a bit. I'm starting to get a feel for what you are trying to accomplish. I am glad you remain able to communicate fairly well through the written word. Michael i really appreciate any help o r pointers i'm reading docss and running tests. rt now:: coffee break {w/ cookies:) later on, gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http
Re: no joy...
On Fri, Dec 23, 2011 at 12:03:11AM +, Emmanuele Bassi wrote: Date: Fri, 23 Dec 2011 00:03:11 + From: Emmanuele Bassi eba...@gmail.com Subject: Re: no joy... To: Gary Kline kl...@thought.org Cc: Michael Torrie torr...@gmail.com, Gtk-app gtk-app-devel-list@gnome.org hi; On 22 December 2011 22:46, Gary Kline kl...@thought.org wrote: [...] my suggestion is to contact the accessibility team - who maintains the a11y features present in gtk+ and in the GNOME platform: https://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel you can use ATK, the accessibility toolkit, to interact with GTK (and other toolkits) from other applications, like the Orca screen reader does. ciao, Emmanuele. ciao bella, signorina bassi! i did belong to one of the accessibitity lists; if the gnome list is `It', then i'm subscribed. maybe that was one i unsub'd a year ago. but good idea,thanks. i'll check. gary -- W: http://www.emmanuelebassi.name B: http://blogs.gnome.org/ebassi/ -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
no joy...
thanks to those who have tried to help, mostly off-list. i can't believe how hard this is. i want to open a base window: gtk_window_set_title(GTK_WINDOW(window),testing); gtk_widget_set_usize(GTK_WIDGET(window),200,300); ... and then only a text window --upon button press-- and display some text: text = gtk_text_view_new(); gtk_container_add(GTK_CONTAINER(window),text); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); and fopen some file and display the text in the buffer. The question remains: how? what am i missing to display some miscellaneous words in the text window? thanks in a advance. gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
no luck with dialogs and ecrooolbars, and gtktext..
Sorry, crummy Subject line before:: n Tue, Dec 20, 2011 at 02:52:10PM -0800, Gary Kline wrote: Date: Tue, 20 Dec 2011 14:52:10 -0800 From: Gary Kline kl...@thought.org Subject: no joy... To: GTK Devel List gtk-app-devel-list@gnome.org thanks to those who have tried to help, mostly off-list. i can't believe how hard this is. i want to open a base window: gtk_window_set_title(GTK_WINDOW(window),testing); gtk_widget_set_usize(GTK_WIDGET(window),200,300); ... and then only a text window --upon button press-- and display some text: text = gtk_text_view_new(); gtk_container_add(GTK_CONTAINER(window),text); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); and fopen some file and display the text in the buffer. The question remains: how? what am i missing to display some miscellaneous words in the text window? thanks in a advance. gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
menu item not showing anything in its window
i thought i would start to put up the standard items on my topmenu bar: File. Edit, Help and so on. but while the following gtk program compiles:: zip. the window is empty and there is no menubar at the top. i have use 'pkg-config' as in my early programs. Anybody know what i'm missing? #include gtk/gtk.h #include strings.h /* Obligatory basic callback */ static void print_hello( GtkWidget *w, gpointer data ) { g_message (Hello, World!\n); } /* This is the GtkItemFactoryEntry structure used to generate new menus. Item 1: The menu path. The letter after the underscore indicates an accelerator key once the menu is open. Item 2: The accelerator key for the entry Item 3: The callback function. Item 4: The callback action. This changes the parameters with which the function is called. The default is 0. Item 5: The item type, used to define what kind of an item it is. Here are the possible values: NULL - Item - Item Title - create a title item Item - create a simple item CheckItem - create a check item ToggleItem - create a toggle item RadioItem - create a radio item path - path of a radio item to link against Separator - create a separator Branch - create an item to hold sub items (optional) LastBranch - create a right justified branch */ static GtkItemFactoryEntry menu_items[] = { { /_File, NULL, NULL, 0, Branch }, { /File/_New, controlN, print_hello, 0, NULL }, { /File/_Open,controlO, print_hello, 0, NULL }, { /File/_Save,controlS, print_hello, 0, NULL }, { /File/Save _As, NULL, NULL, 0, NULL }, { /File/sep1, NULL, NULL, 0, Separator }, { /File/Quit, controlQ, gtk_main_quit, 0, NULL }, { /_Options, NULL, NULL, 0, Branch }, { /Options/Test, NULL, NULL, 0, NULL }, { /_Help, NULL, NULL, 0, LastBranch }, { /_Help/About, NULL, NULL, 0, NULL }, }; void get_main_menu( GtkWidget *window, GtkWidget **menubar ) { GtkItemFactory *item_factory; GtkAccelGroup *accel_group; gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); accel_group = gtk_accel_group_new (); /* This function initializes the item factory. Param 1: The type of menu - can be GTK_TYPE_MENU_BAR, GTK_TYPE_MENU, or GTK_TYPE_OPTION_MENU. Param 2: The path of the menu. Param 3: A pointer to a gtk_accel_group. The item factory sets up the accelerator table while generating menus. */ item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, main, accel_group); /* This function generates the menu items. Pass the item factory, the number of items in the array, the array itself, and any callback data for the the menu items. */ gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL); /* Attach the new accelerator group to the window. */ gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); if (menubar) /* Finally, return the actual menu bar created by the item factory. */ *menubar = gtk_item_factory_get_widget (item_factory, main); } int main( int argc, char *argv[] ) { GtkWidget *window; GtkWidget *main_vbox; GtkWidget *menubar; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (gtk_main_quit), WM destroy); gtk_window_set_title (GTK_WINDOW(window), Item Factory); gtk_widget_set_usize (GTK_WIDGET(window), 300, 200); main_vbox = gtk_vbox_new (FALSE, 1); gtk_container_border_width (GTK_CONTAINER (main_vbox), 1); gtk_container_add (GTK_CONTAINER (window), main_vbox); gtk_widget_show (main_vbox); get_main_menu (window, menubar); gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0); gtk_widget_show (menubar); gtk_widget_show (window); gtk_main (); return(0); } /* example-end */ -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
list troubles?
i've asked what i thought were straightforeward quwstions recently. zip. am i getting thru? thanks, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: list troubles?
On Fri, Dec 16, 2011 at 09:51:30AM +, jcup...@gmail.com wrote: Date: Fri, 16 Dec 2011 09:51:30 + From: jcup...@gmail.com Subject: Re: list troubles? To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org On 16 December 2011 08:17, Gary Kline kl...@thought.org wrote: i've asked what i thought were straightforeward quwstions recently. zip. am i getting thru? The last mail I see from you in my mail archive is 2 days ago, saying thanks to Florian. Were there some more since then? John pretty sure i asked about creating a GTK_TEXT(text) button that would 'popup' a separate thing [window?/widget] that would display the contents of, sasy, 'talk.7.txt' not to complain too much, but given the hours of searching and trying gtk code that flubbed, i got up this morning with some pretty intense pain in my arm and shoulder. --all i need is to open that window with what the user typed. just have it displayed. with a 'close' button. -- that should be enough to finish the project. *Roughly* :) gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
can anybody help me figure out why the two hbox buttons don't show?
people, i am trying to get the decrement and increment buttons to display side by side between the vertical stuff, but only the filename and the window entry show up. anybody know where i'm messing up? gary /* * compile with: * gcc -Wall -Wextra -Werror -g x.c -o x1 `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ #include gtk/gtk.h #include stdio.h #include string.h #define DEFAULT talk. #define DOT '.' static int counter = 1; static GtkWidget *label; static char *suffix = .txt; static char *prefix = talk; char ifbuf[1024]; /* internal filename buffer--CURRENT--for espeak -f */ static void update_label (void) { char buffer[1024]; memset (buffer, 0, sizeof buffer); /* If counter is 1, use markup to highlight text */ if (counter = 1) { if (prefix) { g_snprintf (buffer, 1023, span foreground=\red\ background=\yellow\ size=\x-large\%s%c%d%s/span, prefix, DOT, counter, suffix); } else { g_snprintf (buffer, 1023, span foreground=\red\ background=\yellow\ size=\x-large\%d%s/span, counter, suffix); } gtk_label_set_markup (GTK_LABEL (label), buffer); } else { if (prefix) { g_snprintf (buffer, 1023, %s%c%d%s, prefix, DOT, counter, suffix); } else { g_snprintf (buffer, 1023, %d%s, counter, suffix); } gtk_label_set_label (GTK_LABEL (label), buffer); } } static void inc_button_click_cb (GtkButton * button, gpointer data) { (void) button; GtkWidget *dec_button = data; counter++; /* Change senstivity of the decrement button based on counter */ if (counter 0 !gtk_widget_is_sensitive (dec_button)) gtk_widget_set_sensitive (dec_button, TRUE); /* Update label to show updated counter */ if (prefix) { sprintf (ifbuf, %s%c%d%s, prefix, DOT, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } else { sprintf (ifbuf, %d%s, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } update_label (); return; } static void dec_button_click_cb (GtkButton * button, gpointer data) { (void) data; counter--; if (counter = 0) { counter = 1; } /* Change senstivity of the decrement button based on counter */ if (counter 1 gtk_widget_is_sensitive (GTK_WIDGET (button))) gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); /* Update label to show updated counter */ if (prefix) { sprintf (ifbuf, %s%c%d%s, prefix, DOT, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } else { sprintf (ifbuf, %d%s, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } update_label (); return; } static void entry_changed_cb (GtkEditable * editable, gpointer data) { (void) data; /* Caller has to free the text, so call g_free */ if (prefix == NULL) { puts(pre == null, gfreeing); g_free (prefix); } /* Get the complete text */ prefix = gtk_editable_get_chars (editable, 0, -1); /* Update label to show updated prefix */ update_label (); return; } int main (void) { GtkWidget *button_inc; GtkWidget *button_dec; GtkWidget *entry_label; GtkWidget *entry; GtkWidget *window; GtkWidget *vbox, *hbox; if (prefix == NULL) { puts(prefix is NULL); } gtk_init (NULL, NULL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_title (GTK_WINDOW (window), VoiceByComputer); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL); vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_set_border_width (GTK_CONTAINER (window), 10); label = gtk_label_new (); update_label (); hbox = gtk_hbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (window), hbox); gtk_widget_show (hbox); button_dec = gtk_button_new_from_stock (Decrease counter); g_signal_connect (button_dec, clicked, G_CALLBACK (dec_button_click_cb), NULL); gtk_widget_set_sensitive (button_dec, FALSE); //gtk_widget_show(button_dec); button_inc = gtk_button_new_from_stock (Increase counter); g_signal_connect (button_inc, clicked, G_CALLBACK (inc_button_click_cb), button_dec); //gtk_widget_show(button_inc); entry_label = gtk_label_new (Type in filename prefix below:); entry = gtk_entry_new (); g_signal_connect
Re: can anybody help me figure out why the two hbox buttons don't show?
On Wed, Dec 14, 2011 at 12:14:54AM +0100, Florian M?llner wrote: Date: Wed, 14 Dec 2011 00:14:54 +0100 From: Florian M?llner fmuell...@gnome.org Subject: Re: can anybody help me figure out why the two hbox buttons don't show? To: gtk-app-devel-list@gnome.org X-Mailer: Evolution 3.2.1 On mar, 2011-12-13 at 15:02 -0800, Gary Kline wrote: anybody know where i'm messing up? int main (void) { GtkWidget *window; GtkWidget *vbox, *hbox; [...] gtk_container_add (GTK_CONTAINER (window), vbox); [...] gtk_container_add (GTK_CONTAINER (window), hbox); GtkWindow is a GtkBin, e.g. it can have exactly one child. Florian hm. okay, so i removed the second gtk_container_box and got the same results. the following hbox is missing from the window: button_dec = gtk_button_new_from_stock (Decrease counter); gtk_box_pack_start (GTK_BOX (hbox), button_dec, FALSE, FALSE, 2); g_signal_connect (button_dec, clicked, G_CALLBACK (dec_button_click_cb), NULL); gtk_widget_set_sensitive (button_dec, FALSE); gtk_widget_show(button_dec); in fact, neither button is displayed. gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: can anybody help me figure out why the two hbox buttons don't show?
On Wed, Dec 14, 2011 at 02:03:21AM +0100, Florian M?llner wrote: Date: Wed, 14 Dec 2011 02:03:21 +0100 From: Florian M?llner fmuell...@gnome.org Subject: Re: can anybody help me figure out why the two hbox buttons don't show? To: gtk-app-devel-list@gnome.org X-Mailer: Evolution 3.2.1 On mar, 2011-12-13 at 16:40 -0800, Gary Kline wrote: hm. okay, so i removed the second gtk_container_box and got the same results. the following hbox is missing from the window: button_dec = gtk_button_new_from_stock (Decrease counter); gtk_box_pack_start (GTK_BOX (hbox), button_dec, FALSE, FALSE, 2); g_signal_connect (button_dec, clicked, G_CALLBACK (dec_button_click_cb), NULL); gtk_widget_set_sensitive (button_dec, FALSE); gtk_widget_show(button_dec); in fact, neither button is displayed. Did you add 'hbox' to any container ('vbox' in your code example)? nope. here is what i start out with: window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_title (GTK_WINDOW (window), VoiceByComputer); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL); vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_set_border_width (GTK_CONTAINER (window), 15); below that i create a label and call update_label; then i handle the alignment:: align = gtk_alignment_new (0.5, 0.5, 0, 0); //gtk_container_add (GTK_CONTAINER (window), align); gtk_widget_show (align); then i get an hbox button and call show; after gtk_widget_show, i do the button decrease/button increase code. i'm stumped. hbox = gtk_hbox_new (FALSE, 2); //gtk_container_add (GTK_CONTAINER (align), hbox); gtk_widget_show (hbox); should i NOT be called the show() here? thanks, gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: can anybody help me figure out why the two hbox buttons don't show?
On Wed, Dec 14, 2011 at 02:27:19AM +0100, Florian M?llner wrote: Date: Wed, 14 Dec 2011 02:27:19 +0100 From: Florian M?llner fmuell...@gnome.org Subject: Re: can anybody help me figure out why the two hbox buttons don't show? To: Gary Kline kl...@thought.org Cc: gtk-app-devel-list@gnome.org X-Mailer: Evolution 3.2.1 On mar, 2011-12-13 at 17:23 -0800, Gary Kline wrote: On Wed, Dec 14, 2011 at 02:03:21AM +0100, Florian M?llner wrote: Did you add 'hbox' to any container ('vbox' in your code example)? nope. What I meant to say is: you need to add 'hbox' somewhere in the widget hierarchy. Add it to 'vbox'. Florian thanks! it took me about 4 hours of stumbling around, but i have it! gary PS: to the list: anybody who want to see a new ``accessibility'' toy in the , drop a line. :) -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
how to use hbox?
guys, well, i've reached a stumbling block. the app i am working on had things is a vertical stack. so far, there about 6 rectangles. the first shows the default title and the count: Something like talk.0.txt the second and third rectangles are buttons: Increase Decreate the next space is text that instructs the user to enter an alternate file prefix if he wants. the last rectangle is active in that the user can type into it; and yes, if he types in chat the top rectangle does change. i would like to have the two buttons Increase and Decrease packed together using hbox. i have been trying various things in gtk.org but haven't figured out how to put the buttons that increase or decrease the count. can somebody help me figure out how to pack the buttons horizontally, or is is not possible to mix hbox and vbox? tia, gary Attachment: under devel src -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
no joy... with bvox into hbox
i've tried everything i can think of--or find examples for online to put two vbox buttons into One hbox,Anybody else? gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Why cani i initialize prefix with a default string?
On Sat, Dec 10, 2011 at 03:23:10AM +0100, David Ne??as wrote: Date: Sat, 10 Dec 2011 03:23:10 +0100 From: David Ne??as y...@physics.muni.cz Subject: Re: Why cani i initialize prefix with a default string? To: Gary Kline kl...@thought.org Cc: GTK Devel List gtk-app-devel-list@gnome.org On Fri, Dec 09, 2011 at 05:40:09PM -0800, Gary Kline wrote: guys, i am appending a piece of gtk test code. it saves the internal filename buffer for espeak -f %s ifbuf to run on--to be the user's voice. if i set static char *prefix = talk; then back up and enter another string in the box at the bottom, strange things happen. Anybody know where i am messing up? Strange things most likely occur after attempting to free the const string in entry_changed_cb() g_free(prefix); which was fine if prefix was NULL initially. You can use -Wwrite-strings to catch that. your advice was right on target. i changed the gcc line, then checked if (prefix == NULL) printf(NOT NULL\n) early in main(). since i set prefix , the string printed to stdout. long-story-short, my test program works the way i want. Unforutnately, passing constant strings as various user-data-kind arguments or to g_hash_table_insets() then produces warnings too. okay; i'll watch out! Also learn to use valgrind; it would show you this problem immediately. a couple hours ago i installed valgrind and a front end. The next thing on my to-try list is to get the increase/decrease buttons together; this means reading up on the hbox stuff. i found one example somewhere last week and it looks tricky. --anyhow, thans for your keen insights. gary Yeti -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Why cani i initialize prefix with a default string?
guys, i am appending a piece of gtk test code. it saves the internal filename buffer for espeak -f %s ifbuf to run on--to be the user's voice. if i set static char *prefix = talk; then back up and enter another string in the box at the bottom, strange things happen. Anybody know where i am messing up? tia, gary PS. i am thru with the play button and callback, but would like to understand my errors above first! -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. /* * compile with: * gcc -Wall -Wextra -Werror -g x.c -o x1 `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ #include gtk/gtk.h #include stdio.h #include string.h static int counter = 1; static GtkWidget *label; static char *suffix = .txt; static char *prefix; char ifbuf[1024]; /* internal filename buffer--CURRENT--for espeak -f */ #define DOT '.' static void update_label (void) { char buffer[1024]; memset (buffer, 0, sizeof buffer); /* If counter is 1, use markup to highlight text */ if (counter = 1) { if (prefix) { g_snprintf (buffer, 1023, span foreground=\red\ background=\yellow\ size=\x-large\%s%c%d%s/span, prefix, DOT, counter, suffix); } else { g_snprintf (buffer, 1023, span foreground=\red\ background=\yellow\ size=\x-large\%d%s/span, counter, suffix); } gtk_label_set_markup (GTK_LABEL (label), buffer); } else { if (prefix) { g_snprintf (buffer, 1023, %s%c%d%s, prefix, DOT, counter, suffix); } else { g_snprintf (buffer, 1023, %d%s, counter, suffix); } gtk_label_set_label (GTK_LABEL (label), buffer); } } static void inc_button_click_cb (GtkButton * button, gpointer data) { (void) button; GtkWidget *dec_button = data; counter++; /* Change senstivity of the decrement button based on counter */ if (counter 0 !gtk_widget_is_sensitive (dec_button)) gtk_widget_set_sensitive (dec_button, TRUE); /* Update label to show updated counter */ if (prefix) { sprintf (ifbuf, %s%c%d%s, prefix, DOT, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } else { sprintf (ifbuf, %d%s, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } update_label (); return; } static void dec_button_click_cb (GtkButton * button, gpointer data) { (void) data; counter--; if (counter = 0) { counter = 1; } /* Change senstivity of the decrement button based on counter */ if (counter 1 gtk_widget_is_sensitive (GTK_WIDGET (button))) gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); /* Update label to show updated counter */ if (prefix) { sprintf (ifbuf, %s%c%d%s, prefix, DOT, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } else { sprintf (ifbuf, %d%s, counter, suffix); fprintf(stdout, DEBUG: internsl filename = [%s]\n, ifbuf); } update_label (); return; } static void entry_changed_cb (GtkEditable * editable, gpointer data) { (void) data; /* Caller has to free the text, so call g_free */ g_free (prefix); /* Get the complete text */ prefix = gtk_editable_get_chars (editable, 0, -1); /* Update label to show updated prefix */ update_label (); return; } int main (void) { GtkWidget *button_inc; GtkWidget *button_dec; GtkWidget *entry_label; GtkWidget *entry; GtkWidget *window; GtkWidget *vbox; gtk_init (NULL, NULL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_title (GTK_WINDOW (window), VoiceByComputer); g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL); vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_set_border_width (GTK_CONTAINER (window), 10); label = gtk_label_new (); update_label (); button_dec = gtk_button_new_with_label (Decrease counter); g_signal_connect (button_dec, clicked, G_CALLBACK (dec_button_click_cb), NULL); gtk_widget_set_sensitive (button_dec, FALSE); button_inc = gtk_button_new_with_label (Increase counter
APOLOGIES!! [Was: Re: a couple questions...]
actually, this is primarily to john c, if i bundled up my broken piece of code and send it to the list as well. i was tried to assign a global string to static char *prefix; without accolating the space for the string. because this has to do with speech, my DEFAULT string was simply talk; but maybe the speech-impaired user wanted to use chat or do a quick x or xyz. annyway, long story short, before i can finish my callback like the one that john suggested, i have to make sure that the code withs with it's default. gary PS: NExt post will probably be where i messed up in the play callback. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
a couple questions...
two guys wrote the majority of this gtk widget code. it is meant for the speech-impaired or mute. they type into the editor spawned by gvim or kate, and when the file is written a speech tool of the linux box is their voice. i keep track of the file by inc or dec in case somebody they are talking too didn't hear or understand part of the conversation. if the user is a slow typist and has written a few paragraphs, he just looks back and forth thru the files to find the one that his friends want to hear again. i'll need a play button and callback that invokes, say, espeak -f on that file. if this much makes sense, below in the C code. tia for any insights. cheers, gary kline -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. /* * * gcc -Wall -Wextra -Werror -g y.c -o y1 `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` * */ #include gtk/gtk.h #include string.h #define DEFAULT talk. static int counter = 0; static GtkWidget *label; static char *suffix = .txt; static char *prefix = DEFAULT; static void update_label(void) { char buffer[1024]; memset(buffer, 0, sizeof buffer); /*If counter is 1, use markup to highlight text*/ if(counter = 0 ) { if(prefix) g_snprintf(buffer, 1023, span foreground=\red\ background=\yellow\ size=\x-large\%s%d%s/span,prefix, counter, suffix); else g_snprintf(buffer, 1023, span foreground=\red\ background=\yellow\ size=\x-large\%d%s/span, counter, suffix); gtk_label_set_markup(GTK_LABEL(label), buffer); } else { if(prefix) g_snprintf(buffer, 1023, %s%d%s, prefix, counter, suffix); else g_snprintf(buffer, 1023, %d%s, counter, suffix); gtk_label_set_label(GTK_LABEL(label), buffer); } } static void inc_button_click_cb(GtkButton *button, gpointer data) { (void)button; GtkWidget *dec_button = data; counter++; /* Change senstivity of the decrement button based on counter*/ if(counter 0 !gtk_widget_is_sensitive(dec_button)) gtk_widget_set_sensitive(dec_button, TRUE); /* Update label to show updated counter */ update_label(); return; } static void dec_button_click_cb(GtkButton *button, gpointer data) { (void)data; counter--; if (counter 0) { counter = 0; } /* Change senstivity of the decrement button based on counter*/ if(counter 1 gtk_widget_is_sensitive(GTK_WIDGET(button))) gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); /* Update label to show updated counter */ update_label(); return; } static void entry_changed_cb(GtkEditable *editable, gpointer data) { (void)data; /* Caller has to free the text, so call g_free */ g_free(prefix); /* Get the complete text */ prefix=gtk_editable_get_chars(editable,0, -1); /* Update label to show updated prefix */ update_label(); return; } int main(void) { GtkWidget *button_inc; GtkWidget *button_dec; GtkWidget *entry_label; GtkWidget *entry; GtkWidget *window; GtkWidget *vbox; gtk_init(NULL, NULL); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_title(GTK_WINDOW(window), TalkByComputer); gtk_container_set_border_width(GTK_CONTAINER(window), 10); g_signal_connect(window, destroy, G_CALLBACK(gtk_main_quit), NULL); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(window), vbox); label = gtk_label_new(); update_label(); button_dec = gtk_button_new_with_label(Decrease counter); g_signal_connect(button_dec, clicked, G_CALLBACK(dec_button_click_cb), NULL); gtk_widget_set_sensitive(button_dec, FALSE); button_inc = gtk_button_new_with_label(Increase counter); g_signal_connect(button_inc, clicked, G_CALLBACK(inc_button_click_cb), button_dec); entry_label = gtk_label_new(Type the filename in the space below:); entry = gtk_entry_new(); g_signal_connect(entry,changed, G_CALLBACK(entry_changed_cb), NULL); gtk_box_pack_start(GTK_BOX(vbox), label, 0, 0, 0); gtk_box_pack_start(GTK_BOX(vbox), button_inc, 0, 0, 0); gtk_box_pack_start(GTK_BOX(vbox), button_dec, 0, 0, 0); gtk_box_pack_start(GTK_BOX(vbox), entry_label, 0, 0, 0); gtk_box_pack_start(GTK_BOX(vbox), entry, 0, 0, 0); gtk_widget_show_all(window); gtk_main(); g_free(prefix); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman