Re: serial ports
On Tue, May 15, 2007 at 02:46:22AM +0300, Tor Lillqvist wrote: John Coppens writes: If I'm not mistaken (I don't use windows), look at the g_io functions, I believe they are portable to Windows too. There may be a problem with the names of the devices (COM1: vs /dev/ttyS0) or so, but that is relatively easy to solve, I'd say. You are too optimistic. How well the g_io functions work with serial port devices is quite unclear. Windows is not Unix. Typically you have to use specialized API to talk to each kind of device or IPC channel. Yes! I Agree. A good start to understand serial ports are to read chapter 18 in Advanced programming int the Unix Environment, Richard Stevens, ISBN 0-201-56317-7. -- Göran Hasse Göran Hasseemail: [EMAIL PROTECTED] Tel: 08-6949270 Raditex AB http://www.raditex.se Planiavägen 15, 1tr Mob: 070-5530148 131 34 NACKA, SWEDEN OrgNr: 556240-0589 VAT: SE556240058901 -- ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
AW: Gtk+ and multithreating
Hi list,... ...im sorry if i missunderstand something... Am 14.05.2007 19:53:44 schrieb(en) Michelle Konzack: Hello *, I am new on this list, but have already codes some VERY simple admin GUI's... Now I have a bigger problem/Application which need definitiv multithreading since it must poll several servers and update several TreeView and ListView. I have no experience with it, since I am one of those console-singel-task-no-one-bother-me programmers (Debian GNU/Linux)... :-) OK, for now my GUI is running and then I use a loop like 8 window_main=create_window_main(); while ( TRUE ) { while ( gtk_events_pending() ) gtk_main_iteration(); some_code_to_update_the_dialog } 8 ...could it be two threads try updating the same GUI-Structure !? - trying to resolve their reflections of their updates on the Object-Tree or something that way?? Maybe the simplest way is to code the main thread first, and (ok, here im in pain) then, following new threads, lock that functions changing something GUI-pending for thread-safety; i had already such a Prog, but cannot remember. Was that something with g_mutex_lock !? Threre was a tutorial...anywhere. where some_code_to_update_the_dialog are several functions which are executed one after one. Problem FOR NOW is that each function need ages to get the data and my GUI is dead while running the functions... If there is nothing to do, the CPU load is 100% while running the loop. Oops! Not realy what I want! So, can anyone provide me with a Tutorial HOW TO MULTITHREAD those functions some_code_to_update_the_dialog ? Ok, im still here...hope i understand...u get in to the update function...and update some widgets!?? - or what... ...or it just takes to much time to calculate the data, and for that time your (main-)thread cannot update the gui. Then it should work as i said... -signal to update data starts 2nd thread -main thread does normal gui response -2nd thread got data -2nd thread comes into situation to have to lock (thats that thing i have had a link for) some gui-data so main thread does not conflict with or -me is false and i am just to happy with talking to myself ;) And maybe some other tips... Thanks, Greetings and nice Day Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSN LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: serial ports
Pavel A. da Mek wrote: When I want to use serial ports, shall I write separate code for Windows and for Linux, or is there some library function which would allow to do it in the platform independent way? I have written portable code for this with timeouts for read and write operations. Because Windows don't know a generic select() like call but use special SetCommTimeouts() call I don't know if the g_io_* calls works for Serial port handles. I recommend the following literature to start with this task. POSIX - Serial Programming Guide for POSIX Operating Systems 5th Edition by Michael R. Sweet http://www.easysw.com/~mike/serial/ Windows - Windows Serial Port Programming by Robertson Bayer http://www.robbayer.com/files//serial-win.pdf - Serial Communication in Win32 by Allen Denver http://msdn2.microsoft.com/en-us/library/ms810467.aspx Cheers, Andy ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: serial ports
On Monday 14 May 2007 20:49, Pavel A. da Mek wrote: When I want to use serial ports, shall I write separate code for Windows and for Linux, or is there some library function which would allow to do it in the platform independent way? I hit the same problem in 2004, and I wrote an abstraction layer and 2 different implementations. Basically, I implemented open(), close(), read() and write() using termios.h in linux and the Windows API (CreateFile(), ReadFile(), WriteFile() ...) in windows. read() and write() are implemented in a blocking way, because I'm used to put all the dialing stuff in a separate thread. If you want, I can send you the relevant code: be carefull, it is a beautiful example of bad C C++ mixing. -- Nicola ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to create a simple multilingual GUI
Well, it's possible to change the language in Firefox and in a lot of other programs. I don't mind having to restart the program to do it. I just don't want to have to change the system's local language to do it. I know that gettext is mostly used for internationalisation. However, I have problems creating a program with it where I choose the language in the program, independently of the system settings. If somebody knows how to do this, I would be really grateful for a simple example program, even if it's only command-line and without a GUI. In the meanwhile, I began looking at the source code of tuxtyping, where changing the language at runtime is possible. But having a clear simple source code for something like that really makes it easier. On 5/12/07, rush ta [EMAIL PROTECTED] wrote: if that is at all possible... I would be looking forward to it too !! On 5/11/07, John Zoidberg [EMAIL PROTECTED] wrote: I would like to create a GUI with GTK where the language can be chosen interactively in a settings menu. I would like this to be independant of the machines local language settings. How can I do that? ___ 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: How to create a simple multilingual GUI
On Mon, May 14, 2007 at 12:30:14PM +0200, John Zoidberg wrote: Well, it's possible to change the language in Firefox and in a lot of other programs. That does not make it a good idea. Firefox is designed for Microsoft Windows -- where one had to reinstall the system it to switch languages. Applications tried to work around it and each invented its own language switching mechanism. We've had a standard mechanism since ever. All programs that support localization respect -- or should respect -- language preferences expressed with locale variables. Running LC_ALL=cs_CZ app should run app in Czech. By editing the command used to run the application this should be relatively easy to do with a GUI launcher too -- in fact, the launcher editors in desktop environments should offer the possibility to set the language for individual applications to make it easier. What we don't need is every program inventing its own method to express language preferences. I don't mind having to restart the program to do it. With restarting it is easy. The only thing you need to do is to set locale to the desired one on startup, overriding what you have inherited from environment. See below. I just don't want to have to change the system's local language to do it. What is `the system local language'? Probably there's no such thing and therefore you cannot change it. You can set locale [categories] for each program individually (several possibilities have been listed), and that's what you also should do. I know that gettext is mostly used for internationalisation. However, I have problems creating a program with it where I choose the language in the program, independently of the system settings. Call setlocale() or set LC_* environment variables as suggested, each process has its own. And you should use the inherited locale as the default. If somebody knows how to do this, I would be really grateful for a simple example program, even if it's only command-line and without a GUI. = #include stdio.h #include time.h #include locale.h int main(int argc, char *argv[]) { time_t t; char s[1024]; if (argc 1) setlocale(LC_ALL, argv[1]); time(t); strftime(s, sizeof(s), %c, localtime(t)); printf(%s\n, s); return 0; } = Pass it a locale name and it will print the current date and time in the form preferred for that locale (i.e. language + region) because %c means locale-defined date and time format. Observe it leaves your system local language (whatever it is) intact. Everything else (e.g. adding gettext which is controlled by the same variables or storing the selected language in some preferences file) is a straighforward extension. In the meanwhile, I began looking at the source code of tuxtyping, where changing the language at runtime is possible. But having a clear simple source code for something like that really makes it easier. It is a lot easier if your user interface is a set of independent screens, exactly one active at any time. When you switch languages, you just discard the current screen and construct it again. This is not how a typical Gtk+ application looks like though. Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GTK+ - hide window when minimized
Hello, i'd like to hide my top level window, when user minimizes it. I mean, i don't want the window to be in the task bar - i want to hide it (not minimize it). Can someone help me with this? I've already managed to do that when user closes the window - but with this, i just can't do it. I tried to hide the window in a signal 'window-state-event' handler, but when i did that, window minimized, went from taskbar, then showed up again and it went on and on and on... i had to make hard restart (couldn't figured out how to switch to the console from xfce...), which i never did with linux (i am a good programmer ;-)). Any help would be apretiated. Thanks in advance, Przemu ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Alternative GTK widgets
Perhaps we should all put in some links - this would be beneficial for everybody I think (not all are still active/useful): http://dev.investorsidekick.com/begtkextra/ http://libbit.sf.net/ http://www.curlyankles.com/ http://kornelix.squarespace.com/utilities/ http://sourceforge.net/projects/enlightenment/ - gevas http://gtkadi.sourceforge.net/ http://www.eudoxos.de/gtk/gtkdatabox/index.html http://sourceforge.net/projects/gtkcombogrid http://gtkdateentry.sourceforge.net/ http://gtkmaskedentry.sourceforge.net/ http://helm.cs.unibo.it/mml-widget/ http://view.sourceforge.net/ -- View this message in context: http://www.nabble.com/Alternative-GTK-widgets-tf3730474.html#a10632692 Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list