Re: Finding widget from its name?
[EMAIL PROTECTED] napisa?(a): > Is there a function that allows one to search for a widget using its name or > label? I'm using Glade 2 to design a window (just a basic input form), and > each widget has a unique name. Unfortunately Glade doean't save any global > pointers to the widgets; I can only assume that there must be another way to > find the objects from within the callback functions. Absolutely, there is - glade_xml_get_widget e.g. http://lists.ximian.com/pipermail/glade-users/2004-February/001790.html Regards, Waldek ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Use of fgets, puts, rewind in Gtk+
Sucheta Ghosh napisał(a): > I wished to read a file and get some lines from there like this: > - > fp=fopen("filename", "r"); > for(k=0; k<8; k++){ > n=a[k]; > for (i=1; i<=n; i++) //Here 'n' is the line number > fgets(s, 100, fp); > puts(s); > rewind(fp); > } > - > - > This is the code snippet, which is working so well after compiling with > 'gcc' compiler, but when I added this code inside Gtk+ callback.c, a > runtime error is occuring before execution of 'fgets'. I have already > included 'stdio.h', but even then it is not executing. > > Do you have any idea that how to overcome this problem? I can see some problems here, but that's not really GTK-related; well - there's also a change that included snippet was simply too short 1) no error checking for fopen(), fgets() - You don't to anything if they fail (and that's most probable) 2) can't see any fclose() - multiple "fopen()"s without closing the file is BAD :) 3) You're reading the same file 8 times - and that's *at least* non-optimal - of course that depends on what exactly you're going to achieve, however I'm quite convinced 4) I'd be really careful about placing some external file operations nside of a callback function. but this depends on your overall application purpose and design. Best regards Waldek -- Czas pozegnac finansowe problemy. Kredyt Citibank - prosty kredyt na wszystkie potrzeby. Sprawdz: http://link.interia.pl/f19a5 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Programming with GTK
Steffen Gutmann napisa?(a): > Consider the following macros: > > #define WindowObject gtk_widget_new(GTK_TYPE_WINDOW > #define VBoxObject gtk_widget_new(GTK_TYPE_VBOX [...] > #define End NULL) > > ... allows to write code like this: > > GtkWidget *win, *label, *ok, *cancel; > > win = WindowObject, > "child", VBoxObject, > "child", label = LabelObject, > "label", _("Hello world!"), > "wrap", FALSE. > End, Well, I don't want to let You down, but to me it looks totally unreadable because of introducing a non-C-like syntax. If I want to be readable - I'd rather follow the C-like syntax, because it's very schematic and despite of its disadventages, it's quite easy to browse for a developer with some basic GTK experience. And if I want to be compact - that's what libglade is for. Of course, it's just MY OWN opinion and it's likely that someone would disagree with me :-) Best regards, Waldek -- Kliknij i zacznij dobrze zarabiac. Zyskaj 7% na lokacie! A moze jeszcze wiecej na najlepszych funduszach! Oferta dostepna tylko w Open Finance: http://link.interia.pl/f19ae ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem running the GTK main loop in a separate thread (different from the main one).
O czasie 2009-08-28 13:16, taki ktos jak Cristi Cobzarenco napisac raczyl: Hi, I've been using GTK for a pretty long time but I've never used threads with it and I'm not able to properly run the GTK main loop in a separate thread.More to the point if I create a window, for example, in a thread other than the GTK one, it becomes unresponsive. Other GTK calls (that don't create widgets) seem to work fine, however. I've attached a sample program to show what I mean, the flag "create_in_gt" sets whether to create the widgets in the GTK thread or in the main one. Is this normal behaviour, am I not supposed to do this, or is it a bug? Thou shalt not touch GUI from more than 1 thread. Have a look at http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gtk-thread-awareness.html http://library.gnome.org/devel/gtk-faq/stable/x481.html Hope that helps. Waldek -- Szukasz pracy? Sprawd¼ nasze oferty! http://link.interia.pl/f22b8 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list