Re: How to create a self contained GTK+ Application for Linux
On Tue, 2007-05-22 at 20:29 +, Jeremy Roberson wrote: The majority of our clients are using custom Linux Distributions and they are using older versions of GTK+. Our application depends on features available in GTK+ = 2.10 so, I need to figure out how to distribute the application with all of its dependencies. So, I used ldd to determine all of the dependencies. The output is listed below. -ldd interwrite-learning-systray ... So, I copied all of the shared libraries into a sub directory of the application directory called lib/ for testing. I then used the following commands. -export LD_LIBRARY_PATH=../lib -./interwrite-learning-systray ... Everything runs okay on my system with GTK+ 2.10 I then ran ldd again to see if my application was linked against the libraries that I'm providing in the application directory and sure enough, it is. The output is below. ... So, according the ldd output above, it should work. So, I copied the application over to a test system using an older version of GTK+ and executed the following commands. -export LD_LIBRARY_PATH=../lib -./interwrite-learning-systray And I get a segmentation fault. I then tried ldd and gdb and I get an instant segmentation fault. If I unset the LD_LIBRARY_PATH variable and then try ldd and gdb, they work but the application fails because it's linking against older libraries. Be aware that gcc-3.4.x and gcc-4.x.x are not ABI compatible. If your old system was built with 3.4.x then stuff compiled on the new one won't work. Perhaps you can install gcc-3.4.x on your new system, compile the libraries with that, and then ship them across? ___ 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 self contained GTK+ Application for Linux
Here are a couple of off-beat suggestions: 1. I write in Ruby, so I am able to use RubyScript2exe.rb to create a self-contained GTK+ application. 2. If your users can run virtual machines such as VMware, you can give them your app in a virtual machine that runs a later version of Linux. 3. Have your users run a version of Linux compatible with your app from a bootable CD (Knoppix, Ubuntu, etc.) BTW, Tor, I'm an American living with his Finnish wife in Ryttylä, Finland. Tor Lillqvist wrote: Jeremy Roberson writes: So, I copied all of the shared libraries into a sub directory of the application directory called lib/ for testing. But GTK+ and Pango also look for various other files at run-time. It's not just the shared libraries that are needed. The pathnames of these other files have been compiled in hardcoded in the shared libraries. Some functionality will not work of these files are not found then at run-time. If the compiled-in pathnames happen to match those of an existing older GTK+ installation already on the machine, things might still work, or then not. Off the top of my head, one obvious thing that will depend on run-time opening of files is the gdk-pixbuf loaders. Plus message catalogs, of course, but maybe American English is enough for all your users? --tml ___ 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
HELP: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)'
hi, I'm working on a gtk-project for some month; I already solved a lot of problems by myself, but I'm still learning. But now I have a problem, where I can't find any solution: In my application there's is one window, when I'm closing it, I always can see the following messages: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)' GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed and sometimes the application segfaults after this. The interesting thing is, that there are other windows, that use exactly the same code, but they work without any problems... any hints or tips? ___ 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 self contained GTK+ Application for Linux
On Wed, May 23, 2007 at 12:52:23PM +0300, Alan Lake wrote: 1. I write in Ruby, so I am able to use RubyScript2exe.rb to create a self-contained GTK+ application. RubyScript2Exe monitors the execution of your application. This is done by running your application with a special library. After your application has finished, this special library returns all information about your application to RubyScript2Exe. RubyScript2Exe then gathers all program files and requirements (ruby.exe, rubyw.exe or ruby (and their so's, o's and dll's, determined recursively), *.rb, *.so, *.o and *.dll (and their so's, o's and dll's, determined recursively)) from your own Ruby installation. In other words, unless you manage to make the application to actually use *all* the dynamically loaded files (modules, ...) it can possibly use (when some can depend on regional settings and whoknowswhat), you have to specify them all in RUBYSCRIPT2EXE.* variables including all their dependencies... This can probably work for simple scripts, but don't try it with Gtk+ unless you have a very good idea what to put to the RUBYSCRIPT2EXE.* variables (which essentially amounts to manual packaging). The worst problem is that the resulting binary will appear to work properly in your setup, because that's where you created it. And of course Tor's point about hardcoded paths still apply. 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
Re: HELP: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)'
On Wed, May 23, 2007 at 12:16:51PM +0200, Guenther Meyer wrote: I'm working on a gtk-project for some month; I already solved a lot of problems by myself, but I'm still learning. But now I have a problem, where I can't find any solution: In my application there's is one window, when I'm closing it, I always can see the following messages: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)' GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed and sometimes the application segfaults after this. The interesting thing is, that there are other windows, that use exactly the same code, but they work without any problems... any hints or tips? Use valgrind. And use gdb, since you get segfaults, have you tried to at least print backtrace to see where it crashes? gdb program core.12345 backtrace You can also make GLib abort (and dump core) on CRITICAL or WARNING messages using g_log_set_always_fatal() or more flexibily by setting the G_DEBUG environment variable (see GLib reference documentation). The first two points apply generally, not just to Gtk+ programs. 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
Re: HELP: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)'
Am Mittwoch 23 Mai 2007 12:38 schrieb David Nečas: On Wed, May 23, 2007 at 12:16:51PM +0200, Guenther Meyer wrote: I'm working on a gtk-project for some month; I already solved a lot of problems by myself, but I'm still learning. But now I have a problem, where I can't find any solution: In my application there's is one window, when I'm closing it, I always can see the following messages: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)' GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed and sometimes the application segfaults after this. The interesting thing is, that there are other windows, that use exactly the same code, but they work without any problems... any hints or tips? Use valgrind. yes, I already was told that. but it floods me with messages, so I can't make any use of it. is there agood howto or something like that anywhere? And use gdb, since you get segfaults, have you tried to at least print backtrace to see where it crashes? gdb program core.12345 backtrace yes, but that doesn't really help me... Program received signal SIGSEGV, Segmentation fault. 0x0ef042fc in ?? () from /lib/libc.so.6 (gdb) backtrace #0 0x0ef042fc in ?? () from /lib/libc.so.6 #1 0x0ef041fc in ?? () from /lib/libc.so.6 #2 0x0ef06874 in ?? () from /lib/libc.so.6 #3 0x0ef08ad4 in malloc () from /lib/libc.so.6 #4 0x0f84d2fc in cairo_create () from /usr/lib/libcairo.so.2 #5 0x0fb07f90 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #6 0x0fb08130 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #7 0x0fb09d14 in gdk_window_begin_paint_region () from /usr/lib/libgdk-x11-2.0.so.0 #8 0x0fd250f8 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #9 0x0fb0a1f0 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #10 0x0fb0a4e4 in gdk_window_process_all_updates () from /usr/lib/libgdk-x11-2.0.so.0 #11 0x0fb0a5b0 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #12 0x0f6cbe78 in ?? () from /usr/lib/libglib-2.0.so.0 #13 0x0f6ce674 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #14 0x0f6d2308 in ?? () from /usr/lib/libglib-2.0.so.0 #15 0x0f6d2774 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #16 0x0fd25464 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0 #17 0x10016750 in main (argc=1, argv=0x7fac3824) at gpsdrive.c:5825 You can also make GLib abort (and dump core) on CRITICAL or WARNING messages using g_log_set_always_fatal() or more flexibily by setting the G_DEBUG environment variable (see GLib reference documentation). The first two points apply generally, not just to Gtk+ programs. 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-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: HELP: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)'
On Wed, 2007-05-23 at 12:56 +0200, Guenther Meyer wrote: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)' GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed and sometimes the application segfaults after this. it means you're trying to access a widget long after it has been destroyed. And use gdb, since you get segfaults, have you tried to at least print backtrace to see where it crashes? gdb program core.12345 backtrace yes, but that doesn't really help me... if you are developing with GTK+ it helps a lot to have debug symbols installed so that gdb can return a meaningful stack trace. you should follow your distribution's guidelines on how to install packages with debug symbols for glib and gtk+ at the very least. after that, you should run your application under gdb, launching your application with the --g-fatal-warnings command line switch, which will tell gtk+ to abort() as soon as a warning is issued. this will make tracing where the bug happens a lot easier. ciao, Emmanuele. -- Emmanuele Bassi, E: [EMAIL PROTECTED] W: http://www.emmanuelebassi.net B: http://log.emmanuelebassi.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: HELP: GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)'
On Wed, May 23, 2007 at 12:56:33PM +0200, Guenther Meyer wrote: Use valgrind. yes, I already was told that. but it floods me with messages, so I can't make any use of it. is there agood howto or something like that anywhere? The guide (and quick start guide) on valgrind.org was sufficient for me. If you can read backtraces, it typically prints two backtraces whenever it encounters a problem: of the point where the bad memory access occured and of the point where the memory involved was allocated or freed (in some cases it prints only the former). Well, then there are the problems (and apparent problems) in standard libraries. For start, you can run valgrind on a hello-world style Gtk+ app, let it generate suppressions for all encountered problems, and then use --suppressions to filter these out. You may also want to increase --num-callers and function calls are often nested deeply in Gtk+ apps. And use gdb, since you get segfaults, have you tried to at least print backtrace to see where it crashes? gdb program core.12345 backtrace yes, but that doesn't really help me... Program received signal SIGSEGV, Segmentation fault. 0x0ef042fc in ?? () from /lib/libc.so.6 (gdb) backtrace #0 0x0ef042fc in ?? () from /lib/libc.so.6 #1 0x0ef041fc in ?? () from /lib/libc.so.6 #2 0x0ef06874 in ?? () from /lib/libc.so.6 #3 0x0ef08ad4 in malloc () from /lib/libc.so.6 #4 0x0f84d2fc in cairo_create () from /usr/lib/libcairo.so.2 #5 0x0fb07f90 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #6 0x0fb08130 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #7 0x0fb09d14 in gdk_window_begin_paint_region () from /usr/lib/libgdk-x11-2.0.so.0 #8 0x0fd250f8 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #9 0x0fb0a1f0 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #10 0x0fb0a4e4 in gdk_window_process_all_updates () from /usr/lib/libgdk-x11-2.0.so.0 #11 0x0fb0a5b0 in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #12 0x0f6cbe78 in ?? () from /usr/lib/libglib-2.0.so.0 #13 0x0f6ce674 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #14 0x0f6d2308 in ?? () from /usr/lib/libglib-2.0.so.0 #15 0x0f6d2774 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #16 0x0fd25464 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0 #17 0x10016750 in main (argc=1, argv=0x7fac3824) at gpsdrive.c:5825 It helps to install the debugging info packages, that's corrresponding -dbg, -debug, -debuginfo, or how you distro calls them, to get something better than ??. This look like a problem where the cause and effect are separated -- you g_object_unref()ed something too many times or something like that, and then it got destructed sooner than the holder of the other refences expected, but with luck, where the memory got freed too soon is visible from valgrind's output. 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
Background color of a gtk_window
Hi Is it possible to change the color of the gtk_window? I know how i can change a color of a widget, but in my case it will be much easier to change directly the background-color of the gtk_window... thanks henrik -- View this message in context: http://www.nabble.com/Background-color-of--a-gtk_window-tf3802999.html#a10760718 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
Fake pushing a GTK+ button
I'm pulling my hair out over something that I believe should be easy but I cannot see it. I have a program that has your basic set of buttons, windows, switches and adjustables. I have added a listener to tell me if a directory has been added to or changed. The printf statement works great and says, Directory changed at all the right times and is silent at all the right other times. All I wanted to do was to refresh the directory listing inside the program, unfortunately, I don't know the data structure it uses to create the directory tree. Easy enough, right? All I have to do is tell the program that the refresh button has been clicked whenever the directory changes. No, I don't know enough to know what to put in this post to help, but I've got the code and I do have a decent idea how to read it, ask all the questions you like, I'll be happy to answer. I'm stuck. Thank you DanH ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
menuitem activate
Legacy code I'm trying to update and I've been out of the programming thing for a while. I have a popup menu with this item in it: menuitem = gtk_item_factory_get_item (ifactory, /Refresh Tree); gtk_widget_set_sensitive (menuitem, FALSE); I'm looking at the gtk class reference and find this: ___ gtk.MenuItem.activate def activate() The activate() method emits the activate signal on the menu item. (...) The activate gtk.MenuItem Signal def callback(menuitem, user_param1, ...) menuitem : the menuitem that received the signal user_param1 : the first user parameter (if any) specified with the connect() method ... : additional user parameters (if any) The activate signal is emitted when the menu item is activated. _ Now, how would I use that signal somewhere else in the code to call for a refresh? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Menu_item on menu_bar
Hi All, An irritating problem that I can't find any help for. When I put a gtk_menu_item onto a menu_bar rather than a sub_menu it all seems to work but I need to click the resulting button twice to get the action. If someone could tell me what I'm doing wrong I would be grateful. Thanks, Richard. menu_bar = gtk_menu_bar_new (); gtk_box_pack_start (GTK_BOX(vbox),menu_bar,FALSE,FALSE,0); gtk_widget_show (menu_bar); display_time_item = gtk_menu_item_new_with_label (Station Status); gtk_menu_shell_append (GTK_MENU_SHELL(menu_bar),display_time_item); g_signal_connect_swapped (G_OBJECT(display_time_item),activate,G_CALLBACK(menuitem_response),t ime); gtk_widget_show (display_time_item); *** This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. *** ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, 23 May 2007 10:12:31 -0400, danielg RHCE [EMAIL PROTECTED] wrote: Legacy code I'm trying to update and I've been out of the programming thing for a while. I have a popup menu with this item in it: menuitem = gtk_item_factory_get_item (ifactory, /Refresh Tree); gtk_widget_set_sensitive (menuitem, FALSE); I'm looking at the gtk class reference and find this: ___ [...] _ Now, how would I use that signal somewhere else in the code to call for a refresh? Why don't you just call the callback function which is connected to the signal? Or use g_signal_emit() or g_signal_emit_by_name() to emulate a click on the menu item. Regards, Enrico -- Get my GPG key from http://www.uvena.de/pub.key ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, 23 May 2007 16:18:41 +0200, Enrico Tröger wrote On Wed, 23 May 2007 10:12:31 -0400, danielg RHCE [EMAIL PROTECTED] wrote: Legacy code I'm trying to update and I've been out of the programming thing for a while. I have a popup menu with this item in it: menuitem = gtk_item_factory_get_item (ifactory, /Refresh Tree); gtk_widget_set_sensitive (menuitem, FALSE); I'm looking at the gtk class reference and find this: ___ [...] _ Now, how would I use that signal somewhere else in the code to call for a refresh? Why don't you just call the callback function which is connected to the signal? Or use g_signal_emit() or g_signal_emit_by_name() to emulate a click on the menu item. That's exactly what I'm trying to do, simulate a menu item click. Same set of questions, though. I don't know how to use it. I see the page: _ g_signal_emit_by_name () voidg_signal_emit_by_name (gpointer instance, const gchar *detailed_signal, ...); Emits a signal. Note that g_signal_emit_by_name() resets the return value to the default if no handlers are connected, in contrast to g_signal_emitv(). instance : the instance the signal is being emitted on. detailed_signal : a string of the form signal-name::detail. ... : parameters to be passed to the signal, followed by a location for the return value. If the return type of the signal is G_TYPE_NONE, the return value location can be omitted. __ But I've been out of it so long I'm not sure how to make use of that. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, May 23, 2007 at 10:36:13AM -0400, danielg RHCE wrote: Why don't you just call the callback function which is connected to the signal? Or use g_signal_emit() or g_signal_emit_by_name() to emulate a click on the menu item. That's exactly what I'm trying to do, simulate a menu item click. gtk_widget_activate(item); or gtk_menu_item_activate(item); 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
Re: Fake pushing a GTK+ button
On Tue, 2007-05-22 at 14:26 -0400, DanH wrote: I have a program that has your basic set of buttons, windows, switches and adjustables. I have added a listener to tell me if a directory has been added to or changed. The printf statement works great and says, Directory changed at all the right times and is silent at all the right other times. All I wanted to do was to refresh the directory listing inside the program, unfortunately, I don't know the data structure it uses to create the directory tree. Easy enough, right? All I have to do is tell the program that the refresh button has been clicked whenever the directory changes. gtk_button_clicked() emits the clicked signal on a button. However, unless it is unavoidable, I would submit that thinking about related actions in terms of the buttons to which they're connected is seldom useful. You have an action, refresh directory listing. It is invoked by the refresh button. Could you not just make a change of directory also invoke this action? Granted, there may be situations where this isn't practical. But if you can think in this way, I think it will lead to a better program structure. - Michael ___ 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 self contained GTK+ Application for Linux
Tor Lillqvist tml at iki.fi writes: Off the top of my head, one obvious thing that will depend on run-time opening of files is the gdk-pixbuf loaders. Plus message catalogs, of course, but maybe American English is enough for all your users? --tml Ya, I just realized that when I couldn't find my pixbuf loaders :o). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Fake pushing a GTK+ button
gtk_button_clicked() emits the clicked signal on a button. However, unless it is unavoidable, I would submit that thinking about related actions in terms of the buttons to which they're connected is seldom useful. You have an action, refresh directory listing. It is invoked by the refresh button. Could you not just make a change of directory also invoke this action? Granted, there may be situations where this isn't practical. But if you can think in this way, I think it will lead to a better program structure. I'm trying mostly to just get back in the books. It's been a few years since I've been inside C and I'm doing the 1) make it work THEN 2) make it pretty theory until I can start thinking on my own. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, 23 May 2007 16:49:50 +0200, David Neèas (Yeti) wrote On Wed, May 23, 2007 at 10:36:13AM -0400, danielg RHCE wrote: Why don't you just call the callback function which is connected to the signal? Or use g_signal_emit() or g_signal_emit_by_name() to emulate a click on the menu item. That's exactly what I'm trying to do, simulate a menu item click. gtk_widget_activate(item); or gtk_menu_item_activate(item); Okay, So, with this as the originator: ifactory = gtk_item_factory_from_widget (dirview_popup); (...) menuitem = gtk_item_factory_get_item (ifactory, /Refresh Tree); That's: gtk_menu_item_activate(/Refresh Tree); ?? That gives me a segfault. I know I'm missing something little and stupid but I don't know what it is. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: my summary on how to use gtk with threads
On Sun, 2007-05-20 at 12:15 +0200, Felix Kater wrote: here is my short summery of how to use gtk with threads Ironically, your email rolled in Monday right after I had managed to come up with most of the same information independently. I just blogged about my own findings which are fairly close to your own observations! http://research.operationaldynamics.com/blogs/andrew/#gtk-thread-awareness I didn't quite agree with this conclusion: do not use gdk_threads_set_lock_functions() to facilitate (a) as that was rather critical to things working [so far] for us; hang tight until I get a chance to write up part 2, but I am going to take the time this week to carefully consider the traps you cite and try and see how they affect the pattern we developed. I'm quite certain that this sort of thing will expose bugs in GTK for the simple reason that this style of doing multi-threaded apps is not prevalent -- but such bugs will do well to be smoked out and fixed regardless. Regards, AfC Sydney -- Andrew Frederick Cowie We are an operations engineering consultancy focusing on strategy, organizational architecture, systems review, and change management procedures: enabling successful use of open source in mission critical enterprises, worldwide. http://www.operationaldynamics.com/ Sydney New York Toronto London ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, May 23, 2007 at 11:02:54AM -0400, danielg Posting wrote: gtk_widget_activate(item); or gtk_menu_item_activate(item); Okay, So, with this as the originator: ifactory = gtk_item_factory_from_widget (dirview_popup); (...) menuitem = gtk_item_factory_get_item (ifactory, /Refresh Tree); That's: gtk_menu_item_activate(/Refresh Tree); ?? That gives me a segfault. I know I'm missing something little and stupid but I don't know what it is. http://developer.gnome.org/doc/API/2.0/gtk/GtkMenuItem.html#gtk-menu-item-activate It has argument of GtkMenuItem* type, i.e. you pass the menu item object. No path, name, or anything. The item itself (that's menuitem here). 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
Re: How to create a self contained GTK+ Application for Linux
David Nečas (Yeti yeti at physics.muni.cz writes: This can probably work for simple scripts, but don't try it with Gtk+ unless you have a very good idea what to put to the RUBYSCRIPT2EXE.* variables (which essentially amounts to manual packaging). And of course Tor's point about hardcoded paths still apply. Yeti Hardcoded paths might be okay initially but I need to come up with a more dynamic solution but, I'm not sure there is one. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
Not really GTK-related, but shouldn't the compiler have complained loudly about passing a char* instead of a GtkMenuItem* ? Or are you using a binding of gtk to a language that doesn't check types at compile-time? Jonathan On 5/23/07, David Nečas (Yeti) [EMAIL PROTECTED] wrote: On Wed, May 23, 2007 at 11:02:54AM -0400, danielg Posting wrote: gtk_widget_activate(item); or gtk_menu_item_activate(item); Okay, So, with this as the originator: ifactory = gtk_item_factory_from_widget (dirview_popup); (...) menuitem = gtk_item_factory_get_item (ifactory, /Refresh Tree); That's: gtk_menu_item_activate(/Refresh Tree); ?? That gives me a segfault. I know I'm missing something little and stupid but I don't know what it is. http://developer.gnome.org/doc/API/2.0/gtk/GtkMenuItem.html#gtk-menu-item-activate It has argument of GtkMenuItem* type, i.e. you pass the menu item object. No path, name, or anything. The item itself (that's menuitem here). 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-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 self contained GTK+ Application for Linux
On Wed, 2007-05-23 at 15:07 +, Jeremy Roberson wrote: Hardcoded paths might be okay initially but I need to come up with a more dynamic solution but, I'm not sure there is one. You might want to take a look at what the autopackage folks are doing. At the very least, they have a lot of documentation on what's required to prepare relocatable, portable binary packages. - Michael ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
http://developer.gnome.org/doc/API/2.0/gtk/GtkMenuItem.html#gtk-menu- item-activate It has argument of GtkMenuItem* type, i.e. you pass the menu item object. No path, name, or anything. The item itself (that's menuitem here). I'm with you on everything you said and I feel like a severely slow 7 year old here, it's still not clicking. I've got a method: dirview_popup_menu (DirView *dv, GdkEventButton *event) { (...) menuitem = gtk_item_factory_get_item (ifactory, /Refresh Tree); gtk_widget_set_sensitive (menuitem, FALSE); menuitem = gtk_item_factory_get_item (ifactory, /Make Directory...); gtk_widget_set_sensitive (menuitem, FALSE); } if (!iswritable (path)) { menuitem = gtk_item_factory_get_item (ifactory, /Make Directory...); gtk_widget_set_sensitive (menuitem, FALSE); } if (!parent || !strcmp (parent, .) || !iswritable (parent) || !strcmp (label, .) || !strcmp (label, ..)) { menuitem = gtk_item_factory_get_item (ifactory, /Rename Directory...); gtk_widget_set_sensitive (menuitem, FALSE); menuitem = gtk_item_factory_get_item (ifactory, /Delete Directory...); gtk_widget_set_sensitive (menuitem, FALSE); (...) and I'm trying to activate the refresh menu item. How would it know which menuitem to activate? I also have the standard menu, File, Edit, etc which has this: static void create_gimv_thumb_win_menus (GimvThumbWin *tw) { (...) ifactory = gtk_item_factory_from_widget (tw-menubar); tw-menuitem.file = gtk_item_factory_get_item (ifactory, /File); tw-menuitem.edit = gtk_item_factory_get_item (ifactory, /Edit); tw-menuitem.view = gtk_item_factory_get_item (ifactory, /View); tw-menuitem.tool = gtk_item_factory_get_item (ifactory, /Tool); tw-menuitem.select = gtk_item_factory_get_item (ifactory, /Edit/Select All); tw-menuitem.unselect = gtk_item_factory_get_item (ifactory, /Edit/Unselect All); tw-menuitem.refresh= gtk_item_factory_get_item (ifactory, /Edit/Refresh List); (...) But the Edit menu is not active at the point I want the refresh to take place. I also tried menuitem.refresh and tw-menuitem.refresh. Yes, I do know I'm probably in left field, but I figured I'd just try it all before I asked for help. So, what the heck is menuitem inside the parenthases? Back to my original question. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, 23 May 2007 17:13:56 +0200, Jonathan Winterflood wrote Not really GTK-related, but shouldn't the compiler have complained loudly about passing a char* instead of a GtkMenuItem* ? Or are you using a binding of gtk to a language that doesn't check types at compile-time? I'm just trying everything. Compiler complains if I don't put quotes around it (undeclared (first use of this function)) , compiler doesn't complain when I do, but it segfaults. As I said, I've been out of this game for a few years and have to ask dumb questions for a while. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, May 23, 2007 at 11:25:37AM -0400, danielg Posting wrote: I'm just trying everything. Compiler complains if I don't put quotes around it (undeclared (first use of this function)) , compiler doesn't complain when I do, but it segfaults. As I said, I've been out of this game for a few years and have to ask dumb questions for a while. Please make your compiler more paraonic in that case, at least -Wall -Werror-implicit-function-declaration for gcc. 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
Re: menuitem activate
On Wed, May 23, 2007 at 11:21:41AM -0400, danielg Posting wrote: and I'm trying to activate the refresh menu item. How would it know which menuitem to activate? Leaving aside item factories have been deprecated for a long time: (a) you can store the item somewhere (e.g. in some struct) (b) you can fetch it with gtk_item_factory_get_item() again I also have the standard menu, File, Edit, etc which has this: ... But the Edit menu is not active at the point I want the refresh to take place. I also tried menuitem.refresh and tw-menuitem.refresh. Yes, I do know I'm probably in left field, but I figured I'd just try it all before I asked for help. If you know what action you want to invoke, you can also call the callback function of the item directly (or some other function that performs the requested action), can't you? So, what the heck is menuitem inside the parenthases? Back to my original question. For instance tw-menuitem.file. Any of them. All are menu items. 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
button event release
Hello all, I have a question about button release event. I have a GTK_PANE window. When I press the button I open a socket connection and get back some data from it. Since the opening of socket and getting the data back takes some time I want to display some status messages to the user in a text_view which is added to the lower Pane. My problem is until the button releases my whole application freezes and text_view gets updated after release. How do I start two threads in Gtk so that one thread opens the socket and other thread updates the text_view. Thanks for having the patience to read my long complete email, regards, Bluezapper. - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [SPAM] Re: How to create a self contained GTK+ Application for Linux
Michael Ekstrand wrote: You might want to take a look at what the autopackage folks are doing. At the very least, they have a lot of documentation on what's required to prepare relocatable, portable binary packages. Anyway the GTK hardcoded path are not a good thing IMHO. With some care and the use of -rpath linker option and LD_LIBRARY_PATH you can ship linux binaries using a wide library range. I've shipped a commercial game with ogre, cegui, sdl, devil, boost, libjpeg/png/tiff, libstdc++ and other stuff, but the installer (loki) that use GTK, should stay compatibile with gtk 2.0.x and gtk 1.2.x (there are two versions) cause there is no reliable way to ship gtk statically linked or in a particular path (for the installer for instance a CDROM relative path). Having relative paths in the gtk core libraries what problem could cause? In windows paths are relative so I suppose this could work also on linux, maybe there will be some rework in the autoconf/make scripts at most :) Eg make libgtk-2.0.so try to load: ./gtk-2.0/2.10.0/loaders/libpixbufloader-gif.so Instead of: /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-gif.so Bye, Gabry ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
If you know what action you want to invoke, you can also call the callback function of the item directly (or some other function that performs the requested action), can't you? I guess it'll be shorter to start from the beginning. I'm messing around with GimageView 0.2.27. I want it to auto-refresh the directory tree as new things are added to the directory it starts from with the command line switches. I can loop the reading of the directory all day, but if I do that the refreshes take place before the program is ever drawn to the screen. Not good. I cannot do anything actively until after the program is drawn on the screen. I can make the single click on the refresh button loop as often as I care to do so. Still, requires a click of the mouse. How to eliminate that click. I've put in a method (function?) that uses dnotify to print something added and something changed in the starting xterm at the appropriate times. Cool, now I've got the automated part of notification done. All I want it to do is refresh the directory side of the screen whenever there's a change in the directories I've chosen. There's already a refresh directory method available. I would love to call static void cb_refresh_dir_tree (DirView *dv, guint action, GtkWidget *menuitem) directly, but I have no idea what the pointer to dv needs to be. Well, what does the call back call? refresh_dir_tree (dv, iter); Well, that's no help in the least, I STILL don't know what that *dv is or what it needs to be. I know the iteration (iter) can be NULL and that works for what I'm doing but what the heck is that dv? Okay, so without that, how do I tell the program that the Refresh Directory Tree button has been pushed and let IT figure out what the heck needs to go where. Then we end up with my original question about gtk_button_clicked(). When I looked further into the program, it's not actually a button, it's a GtkWidget: static void cb_refresh_button (GtkWidget*widget I tried making that one a GtkButton *button and that worked for the button still working but I still could not figure out how to press it inside the program from the dnotify. So, digging some more I find that the deprecated menuitem setup is what is being used in the popup as well as the main menu and both have calls to refresh the directory tree. All I have to do is make the program believe one of those has been clicked and it'll refresh. and here's where I sit, knowing that, having a good idea about what I need to do to make it work but unable to figure out what the heck the actual call is. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [SPAM] Re: How to create a self contained GTK+ Application for Linux
On Wed, May 23, 2007 at 06:36:09PM +0200, Gabriele Greco wrote: Michael Ekstrand wrote: You might want to take a look at what the autopackage folks are doing. At the very least, they have a lot of documentation on what's required to prepare relocatable, portable binary packages. Anyway the GTK hardcoded path are not a good thing IMHO. Well, Pango for instance uses environment variables to tell it where config files telling it where other files specifing where its modules reside. Isn't it enough? Having relative paths in the gtk core libraries what problem could cause? AFAIK you can relocate a Gtk+ installation using a combination of environment variables and config files. This way you can also relocate different things into different places. Not that I ever found any use for it... Eg make libgtk-2.0.so try to load: ./gtk-2.0/2.10.0/loaders/libpixbufloader-gif.so Instead of: /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-gif.so And the dot is exactly what? The current directory? Does the library know the directory it was loaded from? Should libraries break when symlinked? 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
Re: menuitem activate
On Wed, May 23, 2007 at 12:38:58PM -0400, danielg Posting wrote: I guess it'll be shorter to start from the beginning. I'm messing around with GimageView 0.2.27. Last release 2.5 years ago? No CVS commit in 2 years? Sounds like a dead project to me. I suggest not to waste your efforts and to contribute to something alive instead. I want it to auto-refresh the directory tree as new things are added to the directory it starts from with the command line switches. I can loop the reading of the directory all day, but if I do that the refreshes take place before the program is ever drawn to the screen. Not good. I cannot do anything actively until after the program is drawn on the screen. I can make the single click on the refresh button loop as often as I care to do so. Still, requires a click of the mouse. How to eliminate that click. I've put in a method (function?) that uses dnotify to print something added and something changed in the starting xterm at the appropriate times. Cool, now I've got the automated part of notification done. All I want it to do is refresh the directory side of the screen whenever there's a change in the directories I've chosen. There's already a refresh directory method available. I would love to call static void cb_refresh_dir_tree (DirView *dv, guint action, GtkWidget *menuitem) directly, but I have no idea what the pointer to dv needs to be. Well, what does the call back call? Now we are getting somewhere. You have to find you what dv is, where is is constructed and how to pass it where you set up the notify handler. It could look like: dv = ... set up the dir view ... /* And here comes your part */ setup_notify(dv, refresh_me); Where setup_notify() remembers dv, the function to call on it, sets up the dnotify() notification (is dnotify() still the preferred mechanism? I recall rumours of it being about to be replaced from approx. 2 years ago) and does something like g_signal_connect(dv, destroy, G_CALLBACK(stop_notifying), NULL); where stop_notifying() is a function to shut down notification for dv and forget dv. And refresh_me() just does static void refresh_me(DirView *dv) { cb_refresh_dir_tree(dv, NULL); } I don't know what the lifetime rules are for the directory views or whether more of them can be present, but this scheme can work quite generally. You can employ a more general callback mechanism, but this should be sufficient in your case. 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
Re: button event release
Hi, There's been some talk about threads in the last couple of weeks on this list, you should be able to lift them from the archive if you just subscribed. An easy alternative to threads in this case would be to connect the socket to a GIOChannel, and have the gtk main loop deal with the data asynchronously: the button will release immediately and the data will get processed when it gets back. A friend and I did this in a program we developped recently, using the gnet library (a glib based library for portable network communication), but you might not need that. _very_ crudely: gnet_tcp_socket_connect_async(adress, port, (_socketConnectAsyncCallback),this); // on the button clic void _socketConnectAsyncCallback(GTcpSocket *socket,GTcpSocketConnectAsyncStatus status, gpointer data) is called when the connection is established (or fails to) then get the channel: _channel = gnet_tcp_socket_get_io_channel(socket); register data arrival handler: g_io_add_watch(_channel, G_IO_IN, (_imageDataReadyForReading), this); send your request: gnet_io_channel_write_%something gboolean _imageDataReadyForReading(GIOChannel *, GIOCondition, gpointer data) is called when some data arrives Voilà Hope it helps, Jonathan On 5/23/07, Bluezapper [EMAIL PROTECTED] wrote: Hello all, I have a question about button release event. I have a GTK_PANE window. When I press the button I open a socket connection and get back some data from it. Since the opening of socket and getting the data back takes some time I want to display some status messages to the user in a text_view which is added to the lower Pane. My problem is until the button releases my whole application freezes and text_view gets updated after release. How do I start two threads in Gtk so that one thread opens the socket and other thread updates the text_view. Thanks for having the patience to read my long complete email, regards, Bluezapper. - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. ___ 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: menuitem activate
You have to find you what dv is, where is is constructed and how to pass it where you set up the notify handler. DirView * dirview_create (const gchar *root_dir, GtkWidget *parent_win, GimvThumbWin *tw) { (...) dnotify is being slowly overtaken by inotify but some of the kernels I run across are older and won't have it in there. I also don't mind the single directory, non-recursive, because that's all I need for this. It could look like: dv = ... set up the dir view ... /* And here comes your part */ setup_notify(dv, refresh_me); Okay, I understand the setup_notify and the dv there, what's the refresh_me for (do?) or is that just another call to the function you have listed below? What would the call to create the setup_notify be? I'm already using int change_notification(void) So, that would be int change_notification (dv, handler) { DirView *dv; struct sigaction act; int fd; (...) and above that would be: static void handler(int sig, siginfo_t *si, void *data, DirectoryView *dv) { event_fd = si-si_fd; cb_refresh_dir_tree(dv, NULL); } Where setup_notify() remembers dv, the function to call on it, sets up the dnotify() notification (is dnotify() still the preferred mechanism? I recall rumours of it being about to be replaced from approx. 2 years ago) and does something like g_signal_connect(dv, destroy, G_CALLBACK(stop_notifying), NULL); okay, g_signal_connect to dv, signal name, callback of stop notification, and data returned (none). So, this is where I need to put the listener (dnotify())? I would like this to go on the entire run of the program. I guess, what's the destroy for? where stop_notifying() is a function to shut down notification for dv and forget dv. And refresh_me() just does static void refresh_me(DirView *dv) { cb_refresh_dir_tree(dv, NULL); } That's the handler() up there. I don't know what the lifetime rules are for the directory views or whether more of them can be present, but this scheme can work quite generally. You can employ a more general callback mechanism, but this should be sufficient in your case. I'm getting there. I understand what I want to do, I'm just relearning how C makes me say it. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: button event release
Hi Jonathan, Thanks for the reply. This was my first post in this forum as I joined the forum today and I am happy to get a reply as in the past months I was asking questions in gtk and gnome forums with a single or no reply at all. I will surely look into the archive now. Actually, I am dealing with Bluetooth sockets in this case, best regards, Bluezapper. Jonathan Winterflood [EMAIL PROTECTED] wrote: Hi, There's been some talk about threads in the last couple of weeks on this list, you should be able to lift them from the archive if you just subscribed. An easy alternative to threads in this case would be to connect the socket to a GIOChannel, and have the gtk main loop deal with the data asynchronously: the button will release immediately and the data will get processed when it gets back. A friend and I did this in a program we developped recently, using the gnet library (a glib based library for portable network communication), but you might not need that. _very_ crudely: gnet_tcp_socket_connect_async(adress, port, (_socketConnectAsyncCallback),this); // on the button clic void _socketConnectAsyncCallback(GTcpSocket *socket,GTcpSocketConnectAsyncS tatus status, gpointer data) is called when the connection is established (or fails to) then get the channel: _channel = gnet_tcp_socket_get_io_channel(socket); register data arrival handler: g_io_add_watch(_channel, G_IO_IN, (_imageDataReadyForReading), this); send your request: gnet_io_channel_write_%something gboolean _imageDataReadyForReading(GIOChannel *, GIOCondition, gpointer data) is called when some data arrives Voilà Hope it helps, Jonathan On 5/23/07, Bluezapper [EMAIL PROTECTED] wrote: Hello all, I have a question about button release event. I have a GTK_PANE window. When I press the button I open a socket connection and get back some data from it. Since the opening of socket and getting the data back takes some time I want to display some status messages to the user in a text_view which is added to the lower Pane. My problem is until the button releases my whole application freezes and text_view gets updated after release. How do I start two threads in Gtk so that one thread opens the socket and other thread updates the text_view. Thanks for having the patience to read my long complete email, regards, Bluezapper. - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list - Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: cairo pixmap
Ah, I just found out the solution is trivial. GdkPixmap *pixmap; /* Create a new backing pixmap of the appropriate size */ static gint configure_event (GtkWidget *widget, GdkEventConfigure *event) { cairo_t *cr; if (pixmap) gdk_pixmap_unref(pixmap); pixmap = gdk_pixmap_new(widget-window, widget-allocation.width, widget-allocation.height, -1); cr = gdk_cairo_create (pixmap); /* do your drawing here */ cairo_destroy (cr); return TRUE; } static gint expose_event_cb (GtkWidget *widget, GdkEventExpose *event) { /* copy relevant part of pixmap back to screen */ gdk_draw_pixmap(widget-window, widget-style-fg_gc[GTK_WIDGET_STATE (widget)], pixmap, event-area.x, event-area.y, event-area.x, event-area.y, event-area.width, event-area.height); return FALSE; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [SPAM] Re: How to create a self contained GTK+ Application for Linux
On Wed, 2007-05-23 at 19:31 +0200, David Nečas (Yeti) wrote: And the dot is exactly what? The current directory? Yes Does the library know the directory it was loaded from? It should, yes. If it really does, I have no idea. Should libraries break when symlinked? No. Why would and should they? One of the few advantages that GTK on windows has over linux is that the entire GTK installation can be self-contained and moved around. Everything is found relative to the dlls automagically. Is this even possible to do in Linux? 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-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: button event release
No problem :) Just out of curiosity, sockets on a bluetooth interface are no different than on ethernet or wifi, I imagine ? Jonathan On 5/23/07, Bluezapper [EMAIL PROTECTED] wrote: Hi Jonathan, Thanks for the reply. This was my first post in this forum as I joined the forum today and I am happy to get a reply as in the past months I was asking questions in gtk and gnome forums with a single or no reply at all. I will surely look into the archive now. Actually, I am dealing with Bluetooth sockets in this case, best regards, Bluezapper. Jonathan Winterflood [EMAIL PROTECTED] wrote: Hi, There's been some talk about threads in the last couple of weeks on this list, you should be able to lift them from the archive if you just subscribed. An easy alternative to threads in this case would be to connect the socket to a GIOChannel, and have the gtk main loop deal with the data asynchronously: the button will release immediately and the data will get processed when it gets back. A friend and I did this in a program we developped recently, using the gnet library (a glib based library for portable network communication), but you might not need that. _very_ crudely: gnet_tcp_socket_connect_async(adress, port, (_socketConnectAsyncCallback),this); // on the button clic void _socketConnectAsyncCallback(GTcpSocket *socket,GTcpSocketConnectAsyncS tatus status, gpointer data) is called when the connection is established (or fails to) then get the channel: _channel = gnet_tcp_socket_get_io_channel(socket); register data arrival handler: g_io_add_watch(_channel, G_IO_IN, (_imageDataReadyForReading), this); send your request: gnet_io_channel_write_%something gboolean _imageDataReadyForReading(GIOChannel *, GIOCondition, gpointer data) is called when some data arrives Voilà Hope it helps, Jonathan On 5/23/07, Bluezapper [EMAIL PROTECTED] wrote: Hello all, I have a question about button release event. I have a GTK_PANE window. When I press the button I open a socket connection and get back some data from it. Since the opening of socket and getting the data back takes some time I want to display some status messages to the user in a text_view which is added to the lower Pane. My problem is until the button releases my whole application freezes and text_view gets updated after release. How do I start two threads in Gtk so that one thread opens the socket and other thread updates the text_view. Thanks for having the patience to read my long complete email, regards, Bluezapper. - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list - Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. ___ 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 self contained GTK+ Application for Linux
On Wed, May 23, 2007 at 02:08:35PM -0600, Michael L Torrie wrote: On Wed, 2007-05-23 at 19:31 +0200, David Nečas (Yeti) wrote: And the dot is exactly what? The current directory? Yes The current directory can be anything. Particularly anything unrelated to the location to the components of the application. Do you really think it's a good idea to make programs work or break depending on something so arbitrary as the current directory? 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
Re: How to create a self contained GTK+ Application for Linux
On Wed, 2007-05-23 at 23:07 +0200, David Nečas (Yeti) wrote: The current directory can be anything. Particularly anything unrelated to the location to the components of the application. Do you really think it's a good idea to make programs work or break depending on something so arbitrary as the current directory? Typical unix pedantic response. The current directory as defined by the directory the gtk dlls are in, yes. And yes it is a good idea. (well, except for the idea of env variables and LD_LIBRARY_PATH, which is a better idea). It works very, very well for the win32 GTK libraries. 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-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: menuitem activate
On Wed, May 23, 2007 at 03:00:03PM -0400, danielg Posting wrote: It could look like: dv = ... set up the dir view ... /* And here comes your part */ setup_notify(dv, refresh_me); Okay, I understand the setup_notify and the dv there, what's the refresh_me for (do?) or is that just another call to the function you have listed below? The function that refreshes the tree is static and therefore probably not visible in the notification code, therefore you have to pass the notification code something to call: pointer to the function. Even if it is visible, passing a callback reduces the entanglement of your spaghetti... What would the call to create the setup_notify be? I'm already using int change_notification(void) So, that would be int change_notification (dv, handler) { DirView *dv; struct sigaction act; int fd; (...) Something similar. Of course you won't have a local variable dv shadowing the argument there, you will keep [the list of] active DirView[s] either in some file-scoped static variable or a static variable in some function managing the list... and above that would be: static void handler(int sig, siginfo_t *si, void *data, DirectoryView *dv) { event_fd = si-si_fd; cb_refresh_dir_tree(dv, NULL); } I'm getting lost here as I don't know anything about the structure of the application (aside from what I have infered from your e-mails) and don't recall anything about dnotify(). So, perhaps maybe. So, this is where I need to put the listener (dnotify())? I would like this to go on the entire run of the program. I guess, what's the destroy for? This was the `I don't know what the lifetime rules' part. The dnotify() handler has to know whether there's something to refresh. If the directory view is destroyed it will segfault trying to refresh it. And even if the directory view exists during the whole lifetime of the program, there's still a small window between the shutdown of the GUI (when the directory view widget is destroyed) and the actual end of the program. So it has to keep track of active DirView[s], somehow. I just suggested one method. 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
Re: How to create a self contained GTK+ Application for Linux
On Wed, May 23, 2007 at 03:12:54PM -0600, Michael L Torrie wrote: Typical unix pedantic response. I asked specifically what you meant because it sounded ridiculous. The current directory as defined by the directory the gtk dlls are in, yes. The current [working] directory is what getwd() returns. At least that's what everyone else seems to mean by the current directory. And yes it is a good idea. And it is ridiculous. It works very, very well for the win32 GTK libraries. Finding self is normally based on GetModuleHandleW() + GetModuleFileNameW() on Win32. I asked how you do this on other systems. Moreover, Win32 has some habit of looking for libraries in the executable's directory, and that's both weird and the only reason why it works. 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
Re: Image process in gdk
Thank you all!. I will try to re-read the Gtk docs following your advice and I will look for theScribble sample. Luis 2007/5/20, David Nečas (Yeti) [EMAIL PROTECTED]: On Sun, May 20, 2007 at 08:39:43PM +0200, Cédric Lucantis wrote: Le dimanche 20 mai 2007 17:45, Luis Ramirez a écrit: It looks like you are confusing GdkPixbuf and GtkPixbuf. A GdkPixbuf is not a widget but only an object storing a bitmap, while a GtkPixbuf is a widget displaying a GdkPixbuf. Anyway, GtkPixbuf is deprecated so you should use GtkImage instead. I'm not sure this cleared all the confusion as GtkPixbuf does not exist. The deprecated widget is called GtkPixmap (and there's really no reason to use it) (and there's also GdkPixmap which is a completely different beast). To sum it up: GdkPixbuf -- RGB[A] pixel buffer, used for basic image data representation and manipulation. GdkPixmap -- off-screen drawable, i.e. off-screen relative of GdkWindow (both are GdkDrawables). GtkPixbuf -- does not exist. GtkPixmap -- deprecated widget, use GtkImage instead. 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-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 self contained GTK+ Application for Linux
At 02:44 PM 5/23/2007, David =?iso-8859-2?B?TmXoYXMgKFlldGkp?= wrote: On Wed, May 23, 2007 at 03:12:54PM -0600, Michael L Torrie wrote: The current directory as defined by the directory the gtk dlls are in, yes. The current [working] directory is what getwd() returns. At least that's what everyone else seems to mean by the current directory. It works very, very well for the win32 GTK libraries. Finding self is normally based on GetModuleHandleW() + GetModuleFileNameW() on Win32. I asked how you do this on other systems. Moreover, Win32 has some habit of looking for libraries in the executable's directory, and that's both weird and the only reason why it works. Yeti (Sorry for being busy-body here...; and keep in mind that I might have not read up the thread messages in details.) If it is to the executable path, it is easier -- by reading the symbolic link target of: /proc/pid/exe if the symbolic link exists. For DSOs, is it an option to get the module load address and parse: /proc/pid/maps to find out the module load address, in the name of making bundled modules work more reliably? -- Daniel Yek ___ 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 self contained GTK+ Application for Linux
On Wed, 2007-05-23 at 23:44 +0200, David Nečas (Yeti) wrote: The current [working] directory is what getwd() returns. At least that's what everyone else seems to mean by the current directory. Well obviously getpwd is not good enough, then. What would be needed is the directory the .so file was loaded from, not the working directory. That's what everyone is meaning here when they say ./blah in the context of the linker. Of course they don't mean the current executable working directory. And yes it is a good idea. And it is ridiculous. You're being difficult for the sake of being difficult. I know you understand what I am meaning about relative paths to the current directory, meaning the directory from which the library was loaded, symlink or no. It works very, very well for the win32 GTK libraries. Finding self is normally based on GetModuleHandleW() + GetModuleFileNameW() on Win32. I asked how you do this on other systems. That's my question too, and others'. In fact, by talking about the ./ stuff that you're so caught on, that's exactly what we are asking. My point was merely, Windows is ahead of us in this area, how can we accomplish the same thing in a clean way? Moreover, Win32 has some habit of looking for libraries in the executable's directory, and that's both weird and the only reason why it works. It's different, but not weird. In fact, in the context of the rest of Windows, it's very logical. And I (and others) am saying, there has to be a better way on Linux and Posix systems. Hard-coded paths are clunky. If GTK's .so files can dynamically find their plugin components based on an environment variable, that is ideal. In fact, if someone could help the original poster in this, that would be the solution to his problem (well, other than ancient libc abi problems). I think that various thread posters have pretty much stated that this is the current, best way to go. Are there any docs on what env strings to set? ___ 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 self contained GTK+ Application for Linux
On Wed, 2007-05-23 at 15:12 -0700, Daniel Yek wrote: (Sorry for being busy-body here...; and keep in mind that I might have not read up the thread messages in details.) No more than the rest of us. :) If it is to the executable path, it is easier -- by reading the symbolic link target of: /proc/pid/exe if the symbolic link exists. For DSOs, is it an option to get the module load address and parse: /proc/pid/maps to find out the module load address, in the name of making bundled modules work more reliably? That is not portable at all. AIX 4 has no /proc, and older unixes may have /proc, but not the maps stuff. Unless Posix has an API for doing this (I don't believe it does), it's not a viable solution. Really, the only issue here is having a way for GTK to find the loadable modules and plugins and things. The linker can find the libraries based on LD_LIBRARY_PATH, and GTK, Pango, and others can (hopefully) be set to check environment variables to find their modules and data files. That's the most portable way to do this, the cleanest, and least dependent on OS-specific behavior. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list