Re: vte widget improvement idea
The most sane thing would probably to treat the whole content of the paste as single command which implicitly means ignoring newlines or escaping them. The user can then ack the whole array of commands by a single enter key press. I find the idea in general pretty good. On Thu, Jun 11, 2015, 10:17 PM Gergely Polonkai gerg...@polonkai.eu wrote: I don't think it is a bad idea per se. Here are some ideas from me: • it should be either turned off by default • or it should warn the user like »hey, you are going to paste multiple lines, are you sure?« with an option to silence such warnings Also I remember a warning, maybe from ViM that warned me about such an occasion. This means that the terminal has some knowledge on this. On 11 Jun 2015 19:13, Wouter Verhelst w...@uter.be wrote: On Thu, Jun 11, 2015 at 06:55:13PM +0300, Martin Kunev wrote: [...] My idea is to add a setting (something like vte_terminal_set_paste_escape()) that, when turned on, escapes the dangerous characters (unquoted line feeds) from the clipboard text and then pastes. [...] Any thoughts on this feature? Do you think this is a good idea? Any suggestions? To be honest, I think that's a terrible idea. You're assuming that pasting something into a shell is always a bad idea. It is if you did it by accident, but if you do it on purpose, it isn't. If I mail my customer to please paste these two commands from their mail into a shell window, I don't want to have to tell them to switch off this protection first. If I have a web page with documentation which says that to create a new user, first run adduser usxername, and then run passwd username, I don't want to have to tack on but you can't paste that in the shell window. There are plenty of valid uses for pasting something into a terminal window. Let's not throw the kid out with the bath water. -- It is easy to love a country that is famous for chocolate and beer -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK threads and socket operations
You modify your label from a thread that is not the main/ui thread. Gtk+ is not threadsafe (few exceptions). Use g_idle_add/ g_timeout_add/ and friends (those are threadsafe) to implicitly serialize your ui modifications into the gtk mainloop. Do not use GDK_THREADS_ENTER/LEAVE foo unless you are maintaining a legacy codebase and you know exactly what this means including its implications. Best Bernhard On Nov 26, 2014 9:02 AM, Sergei Naumov vo...@rambler.ru wrote: Hi! I am writing an application that periodically reads data from network sockets (from Modbus enabled devices actually) and displays them in GTK+ application. I read some tutorials about GTK threads and created a separate thread that encompasses Modbus reads and updates to GTK labels: modbus_thread = g_thread_new (update_from_modbus,update_ from_modbus,NULL); The update_from_modbus() has a bunch of socket reads (inside xantrex_read_value()) and gtk_label_set_text() sprintf(params_val_text,%-5.1f (%4.1f Hz)\n%-4.1f\n%-4d, 0.001*xantrex_read_value(modbus_pointer,0x004C,RECONSTRUCT_YES), 0.01*xantrex_read_value(modbus_pointer,0x004E,RECONSTRUCT_YES), 0.001*xantrex_read_value(modbus_pointer,0x0054,RECONSTRUCT_YES), xantrex_read_value(modbus_pointer,0x0052,RECONSTRUCT_YES)); gtk_label_set_text (GTK_LABEL(ac1_params_val),params_val_text); gtk_label_set_justify(GTK_LABEL(ac1_params_val),GTK_JUSTIFY_LEFT); However after several hours I see crashes when the program tries to reconnect to my device. I tried to enclose GTK operations into gtk_threads_enter() / gtk_threads_leave() but it has no effect. Can anyone, please explain what is wrong here or may be point to a good example of multithreaded GTK code which has network socket operations in it? Thanks in advance, -- Sergei ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Custom Gtk3 Widget - scroll_event
On vri, mei 9, 2014 at 7:18 , Joël Krähemann j...@weedlight.ch wrote: Do you use a GtkScrolledWindow to pack the entire widget? As I know this is the only way to get scrolled-event out of gtk because it has a viewport. No I don't. But I figured out that using GtkDrawingArea instead GtkWidget as baseclass works. So my guess (after having a dive into the code of GtkWidget/DrawingArea) is that the root cause was a missing realize callback, which GtkWidget does not provide where GtkDrawingArea does. Correct me if I am wrong. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Custom Gtk3 Widget - scroll_event
hey! I am trying to derive a custom widget from GtkWidget. (Yet another approach to plot data, I got some special fancy requirements). So I thought I could just overwrite the scroll_event handler/function-pointer and get hold of all scroll events on that widget. But it does not work as expected, the functions gets _never_ called at all. I also tried to use `gtk_widget_{set_sensitive,set_focus,add_events}` but none fixed the issue nor did connecting to the scroll-event signal yield any callback executions. For full demmo source code (yes, a minimal compileable example) is included in the following Stackoverflow question: http://stackoverflow.com/questions/22738105/event-callback-does-not-get-executed-in-custom-gtk3-widget Thanks a lot advance! Best Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Re:Help replacing GtkDrawingArea with GtkLayout
On Mon, Mar 3, 2014 at 5:26 PM, Richard Shann rich...@rshann.plus.com wrote: On Mon, 2014-03-03 at 16:49 +0100, Stefan Salewski wrote: On Mon, 2014-03-03 at 15:17 +, Richard Shann wrote: I have constructed the following minimal example, Yes indeed, https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-events This function must be called while a widget is unrealized. Thank you for giving this some thought. I think it is not the case however that the gtk_widget_show_all() call causes the widget to be realized in gtk-speak, it just sets a flag on the widget to say it should be visible (I am guessing). I think I have just made a breakthrough with my problem however - setting the configure-event signal handler on the parent GtkWindow widget instead of the GtkLayout window it contains causes it to fire off. I have tried this with the scroll-event too and that works. Why this should be different from the case where I use a GtkDrawingArea I have no idea, but it looks like I am cooking with gas! Either - I strongly recommend to stick to gdk_window_add_events (win, GDK_STRUCTURE_MASK); which does not have any dependency on widget/window realization. (I found myself in that very same pit some time ago). Best Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GnomeDateEdit emits no signal on editing entry
Can you provide a complete minimal compileable example? Did you open a bugreport? Best Bernhard On Fri, Feb 21, 2014 at 5:59 AM, John Coppens j...@jcoppens.com wrote: Hi guys gals, This may be common knowledge, but I didn't find any reference. When editing the date manually (without the calendar dropdown), no 'change' signal is emitted, even after exiting the widget. I find this rather strange - how do I detect changes? I found an example in a tutorial, but it only connects to the 'change' signal, so it wouldn't receive those 'manual' changes either. Maybe I could connect to the change signal of the embedded entry, but that would probably defeat any validation checks. John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Using OpenGL with GTK
cogl,clutter,gtkdrawingarea should work - depending on what you want ranging from a framework to convenience rappers to just a gl context. gtkglext is a different story, it renders the whole widget via OpenGL not only the content of a specific widget. Also see http://stackoverflow.com/questions/3815806/gtk-and-opengl-bindings On Sun, Feb 16, 2014 at 2:59 AM, Rena hyperhac...@gmail.com wrote: What's the ideal way to use OpenGL in a GTK application? It seems like there are a few not very good options: 1) GtkGlExt: great except it doesn't support introspection, so I can't use it from a scripting language without manually writing a binding for it. Not sure if it's still supported? A bug to add introspection has been open for ages. 2) GtkGlArea: seems to be a predecessor to GtkGlExt? 3) SDL: no introspection here either, plus I have to have a separate window for the OpenGL render. Is there another way? -- Sent from my Game Boy. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ 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 locate the 'Gtk-WARNING' line number
G_DEBUG=fatal_warnings gdb --args foo.binary arg1 arg2 in gdb, it will crash at some point and if you compiled your program with -g or -ggdb the `backtrace` command will give you some meaningful information For more see: https://developer.gnome.org/glib/stable/glib-running.html https://developer.gnome.org/gtk3/stable/gtk-running.html On Mon, Feb 17, 2014 at 9:44 AM, Wiky wii...@yeah.net wrote: Hi,all. I'm currently writing a program based Gtk+-3.0. When it runs, I get '(a.out:10874): Gtk-WARNING **: Failed to ...' in the terminal. I know the problem is about GtkLabel, but I really don't know which GtkLabel. Is there a way to locate the line numer that give the warning? Sorry for my english ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Still confused on new thread starting idle functions to update UI.
The observed bad behavior is that sometimes messages don't appear at all, or appear twice in my textview. It's quite unpredictable. Sounds like a race condition. I spawn a thread from the main program - and from now on I don't talk about main - and this new thread prepares messages in a character string. The thread then passes a pointer to the character string to an idle function so that the idle function can update a textview in the UI. When done, the idle function stops itself by returning a G_SOURCE_REMOVE boolean. That sounds sane so far. The thread allocates memory for the character string, and the idle function does not free it. Instead, the thread free's the memory just before it stops. It waits a bit to make sure the idle function has finished using the memory containing the message. That does not sound sane. This actually could create a race condition, you never know which thread get scheduled when. I'd recommend you to use a GAsyncQueue, push a ref counted (not necessary in your case here) object (i.e. GByteArray or a custom ref counted version of GString) into it. Keep the idle function until the queue is empty (+deref/destroy the char array/GByteArray/GString). But I lied... Because there are several messages (roughly 30), the thread actually allocates memory for an *array* of character strings. An index is then used to specify which one we're using. This may seem awkward and unnecessary, but if I just use a single character string, it is possible for the thread to replace the contents of the string with the next message while an idle function is still working with the previous message. 3 This is not deterministic, you are trying to rely on probabilistic behaviour and that the mainloop is able to process a certain amount x before your thread shoots again. What I had before which worked was a single character string and a sleep (1) after each g_idle_add(), but that made things very sluggish. Indeed, do not use sleep in order to fix an already broken behaviour (this is not a rule of thumb, this is a do never ever thing). snip.../snip I would've liked to pass the message string to the idle function by value, because then it would only work with its own ephemeral copy of the string, but g_idle_add() only allows me to pass a pointer to data, not the data itself. Use a refcount char array container (like GByteArray and GString is). Hope I could help you, keep asking if something is not clear or if you are uncertain how to do implement things properly. Best Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK Socket and reparenting
Did you try to add an additional reference to your widget? (i.e. explicitly call g_object_ref (your_widget) ) On Tue, Nov 26, 2013 at 3:18 PM, Michal Fizek fizek.mic...@centrum.cz wrote: Actually Gtk.Socket is usable, but the window, that is plugged into the socket gets destroyed(like if Gtk.Plug() was plugged into Socket, but after Socket reparenting, Gtk.Plug() is destroyed). I tried what you have suggested of course, but result is the same. __ Od: Denis Linvinus linvi...@gmail.com Komu: Michal Fizek fizek.mic...@centrum.cz Datum: 26.11.2013 14:54 Předmět: Re: GTK Socket and reparenting CC: gtk-app-devel-list@gnome.org, Gnome List gtk-l...@gnome.org i'm not sure that understand you correctly but, try to return true on connect event of the socket. for example var sock = new Gtk.Socket(); sock.plug_removed.connect(()={ return true;//important! allow reuse of socket }); 2013/11/26 Michal Fizek fizek.mic...@centrum.cz Hi, i have a problem with GTK Socket. I'm using it to build some GUI for my beloved urxvt terminal emulator. But I encountered a big problem, when i need to split screens. URXVT support xembed, so i use GTK Socket to create window, and pass socked id to urxvt, that plugs and embeds itself into a socket. However, then i need to reparent socket to another parent(for example split window, notebook page to another etc.), and there is a problem. When i try to reparent socket the socket plug(in this case embedded urxvt) is destroyed. Is there a way to go around this? Thank you michael ___ gtk-list mailing list gtk-l...@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Valgrind is grinding my gears
Just for the sake of posting it - honored environment variables https://developer.gnome.org/glib/2.37/glib-running.html Best Bernhard On Wed, Nov 6, 2013 at 4:13 AM, David Buchan pdbuc...@yahoo.com wrote: Great! Thanks! Dave From: jcup...@gmail.com jcup...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 4:56 PM Subject: Re: Valgrind is grinding my gears I have a valgrind file here I use for my large gtk2 program: http://www.vips.ecs.soton.ac.uk/development/nip2a.supp I get clean runs with this file. Run with something like: export G_DEBUG=gc-friendly export G_SLICE=always-malloc valgrind --suppressions=/home/john/nip2.supp \ --leak-check=yes \ nip2 ... nip2-vg.log 21 I've not used it for a while, it might need a bit of updating. On 5 November 2013 21:01, David Buchan pdbuc...@yahoo.com wrote: Aaaah. I see. Thanks guys. From: Bernhard Schuster schuster.bernh...@gmail.com To: David Buchan pdbuc...@yahoo.com Cc: David Nečas y...@physics.muni.cz; gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 3:59 PM Subject: Re: Valgrind is grinding my gears No, as soon as you use GObject derived types (or call g_types_init/gtk_init) the class structures for all your gobject derived classes will be created _once_. This unevitable, but nothing to worry about (same for GThread and friends), just be aware of their existance (and/or suppress them in the valgrind output). This has nothing to do with G_SLICE=always-malloc, it actually just reduces the false-positives of valgrind as g_malloc internally allocates big chunks of memory and feeds them as chunks to g_malloc calls, which in turn valgrind sometimes counts as possibly lost and clutters the output. Bernhard On Tue, Nov 5, 2013 at 9:54 PM, David Buchan pdbuc...@yahoo.com wrote: Hi Dave, GObject type registration machinery is, under normal circumstances, only ever used tocreate structures that will exist during the entire program lifetime. Does that mean that if I just use straight old malloc() instead of g_slice(), most of the errors would go away? I gather that's essentially what using G_SLICE=always-malloc would do. I can't try this out until late tonight, unfortunately. From: David Nečas y...@physics.muni.cz To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 2:51 PM Subject: Re: Valgrind is grinding my gears On Tue, Nov 05, 2013 at 09:47:13AM -0800, David Buchan wrote: But when I invoke Valgrind at runtime, I get a lot of errors which I can't make any sense of. I have grabbed a small sample of them here: http://pdbuchan.com/valgrind.txt I don't like ignoring errors and warnings, but I don't know what to do with these. Has anybody else come across these types of Valgrind notifications? Yes, everyone. You must understand that all the GObject type registration machinery is, under normal circumstances, only ever used to create structures that will exist during the entire program lifetime. So although things such as class reference leaks can exists, eveything inside g_type_class_ref() should be ignorable – and you can clearly see from the log that these allocations happen once, not a thousand times. The same for g_thread_init(), gtk_init(), etc. Create a suppression file or google one... Regards, Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Valgrind is grinding my gears
No, as soon as you use GObject derived types (or call g_types_init/gtk_init) the class structures for all your gobject derived classes will be created _once_. This unevitable, but nothing to worry about (same for GThread and friends), just be aware of their existance (and/or suppress them in the valgrind output). This has nothing to do with G_SLICE=always-malloc, it actually just reduces the false-positives of valgrind as g_malloc internally allocates big chunks of memory and feeds them as chunks to g_malloc calls, which in turn valgrind sometimes counts as possibly lost and clutters the output. Bernhard On Tue, Nov 5, 2013 at 9:54 PM, David Buchan pdbuc...@yahoo.com wrote: Hi Dave, GObject type registration machinery is, under normal circumstances, only ever used tocreate structures that will exist during the entire program lifetime. Does that mean that if I just use straight old malloc() instead of g_slice(), most of the errors would go away? I gather that's essentially what using G_SLICE=always-malloc would do. I can't try this out until late tonight, unfortunately. From: David Nečas y...@physics.muni.cz To: David Buchan pdbuc...@yahoo.com Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 2:51 PM Subject: Re: Valgrind is grinding my gears On Tue, Nov 05, 2013 at 09:47:13AM -0800, David Buchan wrote: But when I invoke Valgrind at runtime, I get a lot of errors which I can't make any sense of. I have grabbed a small sample of them here: http://pdbuchan.com/valgrind.txt I don't like ignoring errors and warnings, but I don't know what to do with these. Has anybody else come across these types of Valgrind notifications? Yes, everyone. You must understand that all the GObject type registration machinery is, under normal circumstances, only ever used to create structures that will exist during the entire program lifetime. So although things such as class reference leaks can exists, eveything inside g_type_class_ref() should be ignorable – and you can clearly see from the log that these allocations happen once, not a thousand times. The same for g_thread_init(), gtk_init(), etc. Create a suppression file or google one... Regards, Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Valgrind is grinding my gears
Setting the env var G_SLICE=always-malloc helps a lot (at least from my experience). Also have a look at https://wiki.gnome.org/Valgrind for more stuff like suppression files for various applications, maybe you can derive your own from one of those. If you want to really want get into the nitty gritty details, there is no way around the valgrind/memcheck manual. Best Bernhard On Tue, Nov 5, 2013 at 7:15 PM, David Buchan pdbuc...@yahoo.com wrote: Sorry for peppering you with emails but I just noticed this statement: For newly written code it is recommended to use the new g_slice API instead of g_malloc() and friends, as long as objects are not resized during their lifetime and the object size used at allocation time is still available when freeing - https://developer.gnome.org/glib/unstable/glib-Memory-Slices.html I do indeed change dimensions of arrays declared within my struct (a lot, in fact). Could this be the cause? From: David Buchan pdbuc...@yahoo.com To: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 1:09 PM Subject: Re: Valgrind is grinding my gears Perhaps relevant, is that I have a large struct which I use to pass stuff amongst functions and callbacks and I allocate memory for it in main() thus: // Allocate data structure data = g_slice_new (MyData); and then free it at the end: g_slice_free (MyData, data); Maybe Valgrind has trouble with g-sliced memory? From: David Buchan pdbuc...@yahoo.com To: gtk-app-devel-list list gtk-app-devel-list@gnome.org Sent: Tuesday, November 5, 2013 12:47 PM Subject: Valgrind is grinding my gears I have a rather large program I've written in C language which uses GTK+2. My Makefile has: CCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0` LIBS= `pkg-config --libs gtk+-2.0 gmodule-2.0` GCC compiles it without warnings using flags: -Wall -O -Wuninitialized My program has several user interface files prepared using Glade. I use the program quite a bit and have no stability issues. But when I invoke Valgrind at runtime, I get a lot of errors which I can't make any sense of. I have grabbed a small sample of them here: http://pdbuchan.com/valgrind.txt I don't like ignoring errors and warnings, but I don't know what to do with these. Has anybody else come across these types of Valgrind notifications? Dave ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[no subject]
How to implement a tls/ssl based client with a server side cert? The documentation on that topic is not helpful/confusing (thus posting to both lists). ** (democlient:405): WARNING **: 1 Error 1 - Error performing TLS handshake: An unexpected TLS packet was received. Can somebody please have a look at the below chunk, as the documentation is not really verbose about how to implement it. I also tried a GTlsClientConnection based implementation, but the issue reamins (very same error). The code below is loosly based on one of the test cases of glib-networking. Thanks a lot in adavance! socketclient = g_socket_client_new (); g_socket_client_set_tls (socketclient, TRUE); g_socket_client_set_tls_validation_flags (socketclient, G_TLS_CERTIFICATE_GENERIC_ERROR); con = g_socket_client_connect_to_host (socketclient, 127.0.0.1, 1234, NULL, error); if (error) { g_warning (1 Error %i - %s, error-code, error-message); g_error_free (error); return EXIT_FAILURE; } GIOStream *tlscon = g_tcp_wrapper_connection_get_base_io_stream (G_TCP_WRAPPER_CONNECTION (con)); // do some IO stuff Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gdbus - register handler/object on interface NULL
I have to deal with a closed source server being based on qt + dbus. I try to connect to it via gdbus,glib. The connection works as follows: A mehod/object called message_handler has to be registered to the bus /exported. I call a remote method named send_data, afterwards the service/server calls the local message_handler. Unfortunately it expects the method/object to be at interface NULL, at least that is what I read from the dbus-monitor/bustle logs g_dbus_connection_register_object does not allow a interface NULL pointer. Any help or pointers are appreciated. I opened a pretty detailed question on stackoverflow http://stackoverflow.com/questions/18357703/dbus-register-object-to-remote-on-interface-null Thanks in advance! Best Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gdbus - register handler/object on interface NULL
Thank you for your response, but your code also uses `node_info-interfaces[0]` as `interface` parameter when registering an object - thus does not solve my problem. Any other ideas? Best Bernhard 2013/8/21 Osmo Antero osm...@gmail.com Hello, I have made a small server for Audio-Recorder. Take a look at dbus-server.[ch] modules. http://bazaar.launchpad.net/~osmoma/audio-recorder/trunk/view/head:/src/ $ audio-recorder --help can show the commands that can be sent to the server (to set or ask the recording state). // Osmo (Moma) Antero On Wed, Aug 21, 2013 at 6:10 PM, Bernhard Schuster schuster.bernh...@googlemail.com wrote: I have to deal with a closed source server being based on qt + dbus. I try to connect to it via gdbus,glib. The connection works as follows: A mehod/object called message_handler has to be registered to the bus /exported. I call a remote method named send_data, afterwards the service/server calls the local message_handler. Unfortunately it expects the method/object to be at interface NULL, at least that is what I read from the dbus-monitor/bustle logs g_dbus_connection_register_object does not allow a interface NULL pointer. Any help or pointers are appreciated. I opened a pretty detailed question on stackoverflow http://stackoverflow.com/questions/18357703/dbus-register-object-to-remote-on-interface-null Thanks in advance! Best Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- // moma http://www.futuredesktop.org ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: updating labels when a key is stroked
Keep asking, sometimes the response delay is actually a good thing :) A side note: depending on what version of gtk you are using, signals may change (i.e. gtk2 expose_event, gtk3 draw) so keep an eye open when following tutorials. Best Bernhard On Fri, Aug 9, 2013 at 12:14 PM, Eric Wajnberg eric.wajnb...@sophia.inra.fr wrote: Ok, thanks! I'm just plain stupid. I indeed just have to collect a key_press_event event and that's it! Sorry for disturbing the list with such a basic question (I am still learning how to use gtk).. Cheers to all, Eric. Kang Hu wrote, On 09/08/2013 09:39, all you need is an event filter. remove the 'g_timeout_add' line with the following code. 0. get the gdk window of the created top-level gtk window. GdkWindow https://developer.gnome.org/gdk2/stable/gdk3-Windows.html#GdkWindow* gtk_widget_get_window https://developer.gnome.org/gtk3/3.8/GtkWidget.html#gtk-widget-get-window(/|GtkWidget https://developer.gnome.org/gtk3/3.8/GtkWidget.html *widget|/); GdkWindow* gdkwindow = gtk_widget_get_window (pWindow); 1. add event mask you're interested in voidgdk_window_set_events https://developer.gnome.org/gdk3/3.8/gdk3-Windows.html#gdk-window-set-events(/|GdkWindow https://developer.gnome.org/gdk3/3.8/gdk3-Windows.html#GdkWindow *window|/,/|GdkEventMask https://developer.gnome.org/gdk3/3.8/gdk3-Events.html#GdkEventMask event_mask|/); gdk_window_set_events (gdkwindow, GDK_KEY_PRESS_MASK); 2. register an event filter voidgdk_window_add_filter (/|GdkWindow https://developer.gnome.org/gdk3/3.8/gdk3-Windows.html#GdkWindow *window|/,/|GdkFilterFunc https://developer.gnome.org/gdk3/3.8/gdk3-Windows.html#GdkFilterFunc function|/,/|gpointer https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer data|/); gdk_window_add_filter (gdkwindow, key_press_filter, pWindow); 3. write the filter function. GdkFilterReturn https://developer.gnome.org/gdk3/3.8/gdk3-Windows.html#GdkFilterReturn (*GdkFilterFunc) (/|GdkXEvent https://developer.gnome.org/gdk3/3.8/gdk3-Windows.html#GdkXEvent *xevent|/,/|GdkEvent https://developer.gnome.org/gdk3/3.8/gdk3-Event-Structures.html#GdkEvent *event|/,/|gpointer https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer data|/); GdkFilterReturn key_press_filter (GdkXEvent* xevent, GdkEvent* event, gpointer data) { // how to process key press events. } On Wed, Aug 7, 2013 at 8:48 PM, Eric Wajnberg eric.wajnb...@sophia.inra.fr mailto:eric.wajnb...@sophia.inra.fr wrote: Hi there, I need to develop a gtk code in which a label is changed each time a key is stroked on the keyboad. I thus use g_timeout_add() to launch on a regular basis a function that listens to key strokes. Within this function, I used a combination of kbhit()/getch() to collected the stroken keys (because I do not want the user to hit the return key all the time) and update the label accordingly. The following code is just a try, and seems ok: #include stdlib.h #include stdio.h #include conio.h #include gtk/gtk.h int key=0; char string[500]; int main(int argc, char **argv) { /* declaration of widgets */ GtkWidget *pWindow; /*main windows */ GtkWidget *pLabel; /* a label */ void OnDestroy(GtkWidget *pWidget, gpointer pData); /* function call back destroy */ gboolean update(gpointer pData); /* function called at regular intervals */ /* Initialisation of GTK+ */ gtk_init(argc, argv); /* creation of the main window */ pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* parameters of the window */ gtk_window_set_position(GTK_WINDOW(pWindow), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(pWindow), 300, 100); gtk_window_set_title(GTK_WINDOW(pWindow), testing key input); /* creation of the label */ (void)sprintf(string,%d,key); pLabel=gtk_label_new(string); /* adding the label to the window */ gtk_container_add(GTK_CONTAINER(pWindow), pLabel); /* signal connexion */ g_signal_connect(G_OBJECT(pWindow), destroy, G_CALLBACK(OnDestroy), NULL); /* function called at regular intervals .. */ g_timeout_add((guint)1, update,(gpointer *)pLabel); /* showing the window */ gtk_widget_show_all(pWindow); /* starting the loop */ gtk_main(); return EXIT_SUCCESS; } gboolean update(gpointer pData) { /* updating the label */ if (kbhit()) { key=getch(); (void)sprintf(string, %d,key); gtk_label_set_label(GTK_LABEL(pData), string); } return TRUE; } void OnDestroy(GtkWidget *pWidget, gpointer pData) { /* stopping the loop */ gtk_main_quit(); } The point is that this is
Re: ComboBox
https://developer.gnome.org/gtk2/2.24/GtkComboBox.html I am not aware of the changes between 2.0 (which the tutorial targets) and 2.24, but you should try to replace it with the API above. Not sure though, I educated guess needs more information (i.e. your includes, sourcecode - preferably where the error occures +- n lines) /Bernhard On Thu, Jun 27, 2013 at 3:46 PM, Rui Pedro Caldeira rpcalde...@outlook.com wrote: Hello guys, I'm new to GTK+ and I've run into a problem when creating a ComboBox. I'm using GTK+ 2.24.18 and following the tutorial from this page: https://developer.gnome.org/gtk-tutorial/2.24/x1063.html But when I try to compile the code, it seems that none of the functions I call exists in the gtk.h file Output: xxx.c: In function ‘XXX’: xxx.c:63:2: warning: implicit declaration of function ‘gtk_combo_new’ [-Wimplicit-function-declaration] xxx.c:63:8: warning: assignment makes pointer from integer without a cast [enabled by default] xxx.c:65:2: warning: implicit declaration of function ‘GTK_COMBO’ [-Wimplicit-function-declaration] xxx.c:65:101: error: invalid type argument of ‘-’ (have ‘int’) xxx.c:111:3: warning: statement with no effect [-Wunused-value] xxx.c:116:3: warning: format not a string literal and no format arguments [-Wformat-security] xxx.c:123:2: warning: implicit declaration of function ‘gtk_combo_set_popdown_strings’ [-Wimplicit-function-declaration] xxx.c:127:2: warning: implicit declaration of function ‘gtk_combo_set_use_arrows’ [-Wimplicit-function-declaration] xxx.c:54:6: warning: unused variable ‘status’ [-Wunused-variable] If you could help me I would be thankful Best regards, Rui ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: ComboBox
gtk-2.24 is still current in CentOS/RedHat Enterprise/Scientific Linux and static linking might be not allowed due to license restrictions. On Thu, Jun 27, 2013 at 6:09 PM, Rudra Banerjee rudra.baner...@aol.co.uk wrote: gtk+2 itself is old, and if there is no other reason, you should (since you are new) use gtk+3. The documentation is at https://developer.gnome.org/gtk3/3.8/ On Thu, 2013-06-27 at 14:46 +0100, Rui Pedro Caldeira wrote: Hello guys, I'm new to GTK+ and I've run into a problem when creating a ComboBox. I'm using GTK+ 2.24.18 and following the tutorial from this page: https://developer.gnome.org/gtk-tutorial/2.24/x1063.html But when I try to compile the code, it seems that none of the functions I call exists in the gtk.h file Output: xxx.c: In function ‘XXX’: xxx.c:63:2: warning: implicit declaration of function ‘gtk_combo_new’ [-Wimplicit-function-declaration] xxx.c:63:8: warning: assignment makes pointer from integer without a cast [enabled by default] xxx.c:65:2: warning: implicit declaration of function ‘GTK_COMBO’ [-Wimplicit-function-declaration] xxx.c:65:101: error: invalid type argument of ‘-’ (have ‘int’) xxx.c:111:3: warning: statement with no effect [-Wunused-value] xxx.c:116:3: warning: format not a string literal and no format arguments [-Wformat-security] xxx.c:123:2: warning: implicit declaration of function ‘gtk_combo_set_popdown_strings’ [-Wimplicit-function-declaration] xxx.c:127:2: warning: implicit declaration of function ‘gtk_combo_set_use_arrows’ [-Wimplicit-function-declaration] xxx.c:54:6: warning: unused variable ‘status’ [-Wunused-variable] If you could help me I would be thankful Best regards, Rui ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 - A common event handler - Gone OT into cairo and draw territory
On Thu, May 23, 2013 at 1:50 PM, Donn donn.in...@gmail.com wrote: Thanks for your thoughts, I have pushed my luck and replied :) On 22/05/2013 17:18, Bernhard Schuster wrote: If you compose your stuff of polygons (which I am pretty sure you do), there is pretty neat math to check if your cursor is in or outside of a polygon (for low vertex count polygons, for greater numbers you need to calculate a boundingbox that is fixed for at least a few frames). This actually detaches the position-checks from the drawing event. A somewhat-model-view approach. I have actually used that point in a polygon algorithm. The problem is the matrix transforms and the disjunct between the mouse coordinates and the coordinate space within which the target shape exists. Store the matrix, convert the mouse pointer to canvas space (or polygonspace), not the other way round. The device to user and back stuff. I don't know how to get the user_space without the Cairo Context and this comes around to the catch-22 again: You only get a Context in the draw() signal handler. whole thing also depends on your backend. If you got a decent ( OpenGL 2.1 or newer ) video card it is not really sane to calculate dirty regions and redraw them (especially if you got a lot of items floating/hanging around). I'm not sure what 'backend' my GTK library is using. I'm fairly sure it's not drawing Cairo paths and fills directly into GL - I reckon it's still CPU bound and it's filling memory arrays which are then being handed-down to the lower voodoo which mysteriously gets it to the screen. i.e. it's texture maps onto GL rectangles managed by Unity (I'm on ubuntu atm) If you can not be sure what your target devices have as backend (not to even speak of implementation specific stuff) set a lower-border and develope against that (i.e. software rendering) The thing is - *if* the canvas has *not* changed, *but* I have a tool or icon on the topmost layer that moves (I call it a sprite) by a few pixels, then it makes more sense to do a small blit of the old background and draw the sprite in a new position - rather than drawing all my canvas objects again just so I can draw the sprite in a new position. That means you need to walk your tree, check all items bounding boxes and redraw all which intersect with the boundingbox of the item moved (in the old and new position, otherwise you'd get artifacts) I see what you mean. But how? 9 Sorry, you will have to figure that out on your own - I am not sure that it is possible at all - my familiarity with cairo is limited to a quite small subset of API calls (mostly polygon and matrix stuff, nothing blitting related (yet)). It's really a job for a block-copy kind of blit thing. I have asked over on the Cairo list for such help, but there's little response. I have been told to look into patterns and surfaces - so that's where I'm heading. Slowly. * Picture: A blue sky gradienting to white. A bunch of cloud images superimposed, their alphas show the background. The clouds stack above each other - many layers. They move left to right, some the other way. There's an animated glowing Sun that rises behind them but in-front of the gradient sky. Winter leaves blow in path-following spirals in the foreground. We pause the animation and are editing. A small 32x32 eyeball icon appears at my mouse when I hit space. It intersects with: 1. a bit of the leaf vector - which is itself a group of many smaller shapes and fills to form the leaf. 2. several layers of bits of clouds 3. some section of the sun -- also a group of child shapes. For e.g. the 'rays' would be triangles repeated under a rotation transform. 3. some section of the gradient sky. If your clouds move you got some kind of clocking don't you? If so then just store all your events into static/global vars (yes, that's ugly - find a better solution - hint: user_data) and do the checks in a clocked interval (reminder: g_timeout_add is not very suiteable, as it is a round about timer) Keep trying, there is always that reading-foreign-code barrier - at first it sometimes looks all gibberish :) Boy, you said it! I shall persevere. Makes somewhat sense, you are expected to pass a class instead of a bare function. You can then stuff all your data into that class, the only limitation in comparsion to C is, that your class _must_ contain the handler too. And thanks for this! Good luck and keep going. Note: If you are going for such a complex widget - if you want to share it - it is usually better (as of everybody will be able to use it) if you write it in good old C. VALA after all compiles to C, but well .. code compiler gibberish all over the place. Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 - A common event handler - possible?
On Wed, May 22, 2013 at 11:00 AM, Donn donn.in...@gmail.com wrote: On 22/05/2013 09:29, Bernhard Schuster wrote: In general factoring code is good (at least that's my opinion) - what you are trying to do is the reverse and will give you one very big function, hardly readable. I take your very good point. I really suggest you to go with seperate handlers. If you need cross handler information, then you should create yourself a context object and store desired information into that and obtain it from that, you can simply pass the context object as the user_data gpointer. I will attempt grokkage of this user_data thing. I've seen it in the C docs, but I'm newly into Vala, and it looks ... weird: https://live.gnome.org/Vala/SignalsAndCallbacks (at end) Never really got into vala, and I currently lack the time to give it a whirl. Why do you want to disabel doublebuffering in the first case? Two zones of reasons, both hopefully full of fail and new hope! :P A: As it seems now , in order to discover whether the cursor in inside a shape, I have to draw a path and use cr_in_fill(). This can only happen when I have a Cairo context! That only happens in the draw() signal handler! If you compose your stuff of polygons (which I am pretty sure you do), there is pretty neat math to check if your cursor is in or outside of a polygon (for low vertex count polygons, for greater numbers you need to calculate a boundingbox that is fixed for at least a few frames). This actually detaches the position-checks from the drawing event. A somewhat-model-view approach. Correct me if I misunderstod something. There are a lot of approaches on how to actually get dirty regions (moved items + bounding boxes + tree walk). Also be aware that this whole thing also depends on your backend. If you got a decent ( OpenGL 2.1 or newer ) video card it is not really sane to calculate dirty regions and redraw them (especially if you got a lot of items floating/hanging around). So, in order to simply discover this fact, I have to force a complete redraw (queue_draw()) and this then draws *all* my canvas objects again, from scratch. A very heavy burden for one mouse motion event. (Add to this that the object which I am motioning over may be under several transforms. i.e. I have to transform several times before I get to draw that path in order to test in_fill) B: Also, I'm still struggling with the various options - I can draw every object from bottom to top, on every draw(). I can draw each object to a memory surface (cairo pattern) and then compose them all, back to front, every draw(). The thing is - *if* the canvas has *not* changed, *but* I have a tool or icon on the topmost layer that moves (I call it a sprite) by a few pixels, then it makes more sense to do a small blit of the old background and draw the sprite in a new position - rather than drawing all my canvas objects again just so I can draw the sprite in a new position. That means you need to walk your tree, check all items bounding boxes and redraw all which intersect with the boundingbox of the item moved (in the old and new position, otherwise you'd get artifacts) Thus, the double-buffering that blanks the canvas screws the pooch ;) See first answer chunk. In case that is not really important to you, you could have a look at goocanvas.. I guess I'm just keen to see if I can do this (a canvas vector art zui draggy thing) on my own. I have the Goo source but it's just as confusing to me as the Inkscape source. Still, I do try. Keep trying, there is always that reading-foreign-code barrier - at first it sometimes looks all gibberish :) . But goocanvas (as far as I can say from reading a few specific pieces of code) is pretty well documented, so it should not take too long until the first chunks start making sense - a good editor also helps. Best \B ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Fixed origin zoom with goocanvas
I am trying to create zoomable goocanvas, which zooms towards the current pointer position instead of the center of the visible part of the goocanvas. Unfortunately my correction offset seems to be correct mathematically but does not work if I implement it. As the implementation spans some lines of C-code, I created a structured question at stackoverflow http://stackoverflow.com/questions/15212219/goocanvas-coordinate-systems-and-zooming I hope this kind of pointer is acceptable for this mailinglist. Thanks for your time, I'd appreciate any kind of tip or pointer. Best regards, Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: a question about g_strconcat()
I answered that some time ago: http://stackoverflow.com/questions/11486704/c-sql-query-building-made-easy/11725655#11725655 On Thu, Feb 28, 2013 at 1:22 PM, Cifer Lee mantia...@gmail.com wrote: first, I will show some lines. [code] gchar *str_sample = g_strconcat(I have a, dream that, NULL); str_sample = g_strconcat(str_sample, one day, NULL); str_sample = g_strconcat(str_sample, we can be friends., NULL); // do some work with str_sample g_free(str_sample); [/code] if, for some reasons, I must call g_strconcat() three times, or in concrete, I must follow some conditions to determine whether should I concatenate each of the three phrases okay, actually, I am writing a sql query phrase, like this: if the parameter an_id is a empty string, then I will not append it to the select phrase. select * from a_table where 1=1 and `id`='an_id' and `name`='a_name' actually, I have debug my program and find that each time the str_sample variable has been assigned a different address. But I'm not sure the internal mechanism of g_strconcat(), whether it apply for a totally new space or a space that may overlap with the earlier applied space, if the latter, then I can't free the earlier applied space, and I think it may lead to memory leak. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: change alternate treeview row color with css
See example 26 http://developer.gnome.org/gtk3/unstable/GtkCssProvider.html 2013/1/25 Rudra Banerjee rudra.baner...@aol.co.uk: I tried to change alternate row color of TreeView using css as: GtkCssProvider *provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, GtkTreeView {\n .row:nth-child(even): green;\n .row:nth-child(odd):red;\n }\n, -1, NULL); GdkDisplay *display = gdk_display_get_default (); GdkScreen *screen = gdk_display_get_default_screen (display); gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); This is giving runtime warning: (mkbib:6745): Gtk-WARNING **: Theme parsing error: data:2:1: Expected semicolon (mkbib:6745): Gtk-WARNING **: Theme parsing error: data:3:1: Expected semicolon Where I went wrong? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Crediting beta testers?
File a request :) Am 13. April 2012 08:30 schrieb Christopher Howard christopher.how...@frigidcode.com: I've really appreciated how convenient the GtkAboutDialog class is and especially the gtk_show_about_dialog() function. The only thing that seems to be missing: There is a property for every basic kind of credit that could be given (authors, translators, artists, etc.) but no property for (beta) testers. I would think that would be a rather popular one, and in my case beta testing is about the only thing I don't do myself. I am curious if anyone ever thought of adding a component for that. Or perhaps some kind of miscellaneous credits field, for giving credit to people who don't fit in any other category? -- frigidcode.com indicium.us ___ 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: GtkDrawingArea size
If you did not yet start implementing it, goocanvas might be another option to the bare stuff. goocanvas allows you to set a fixed paper size. Am 7. März 2012 19:44 schrieb Christopher Howard christopher.how...@frigidcode.com: On 03/06/2012 02:08 PM, Christopher Howard wrote: Hello again. So, I recently started a project to create a certain board game (in C) using gtk+, and I just started learning gtk+. I was planning to draw the board graphics, pieces, etc. all into one GtkDrawingArea. So, how do I fix the size of the drawing area so it doesn't get larger or smaller than my graphics? The alternative, I suppose, would be to scale everything against the actual size of the drawing area (cairo can resize bitmap images, no?) but presumably that would be a lot more complicated to code, and I would still need to constrain the proportions of width to height. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Bump. I'm trying to look through some other projects to see how this is done, but I would appreciate it if anyone happens to know of the top of their head. -- frigidcode.com indicium.us ___ 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: memory lead while using Glib regexp
No it does, not I already cross-read it and it looks fine, did you give it a shot with valgrind? Regards Bernhard Schuster Am 5. März 2012 15:43 schrieb Olivier Sessink oliviersess...@gmail.com: On 03/02/2012 04:00 AM, Xi Yang wrote: Hi, everyone! I use Glib's regular expression in a cycle, and find a rapid memory consumption increase. Did I forget to release anything? since nobody replied I'll give it a shot (without any C++ knowledge): does seq.header.c_str() return a newly allocated string? Olivier Thanks a lot! = code below == GRegex* regex_illumina = g_regex_new( @(.+):(\\d+):(\\d+):(\\d+):(\\d+)#(\\d+)/([12]), G_REGEX_OPTIMIZE, GRegexMatchFlags(0), NULL ); GRegex* regex_casava_1p8 = g_regex_new( @(.+):(.+):(.+):(\\d+):(\\d+):(\\d+):(\\d+) ([12]):([YN]):\\d+:(\\w*), G_REGEX_OPTIMIZE, GRegexMatchFlags(0), NULL ); // inside cycle body gchar* tile_str; int tile; GMatchInfo* what; // match and fetch something if ( g_regex_match(regex_illumina, seq.header.c_str(), GRegexMatchFlags(0),what) ) { tile_str = g_match_info_fetch(what,3); } else if ( g_regex_match(regex_casava_1p8, seq.header.c_str(), GRegexMatchFlags(0),what) ) { tile_str = g_match_info_fetch(what,5); } else { throw runtime_error(failed to parse header line:\n+seq.header); } // parse a number if (sscanf(tile_str,%d,tile)!=1) throw runtime_error(failed to fetch tile from +seq.header); // release match info and fetched string g_match_info_free(what); g_free(tile_str); // end of cycle body ___ 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 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: porting Xlib/Motif apps to GTK+
really need that high throughput, you can also give goocanvas or bare cogl. But that is up to your application and what kind of systems you target. (6) Am I going in completely the wrong direction, should I be porting this code to some other 2D graphics GUI? Or alternatively, should I just forget the whole thing and hope that OpenMotif and Xlib stay around for a considerably longer period, at least until I retire (another 15 years or so) and this becomes somebody else's nightmare? ;- Gtk+ is one of the widely used toolkits, an alternative would be Qt (a bit slower, proper windows support, C++, increased abstraction, stupid preprocessor, sometimes nasty debugging). If you are used to Motif then I'd go for gtk+ (7) If I decide to go this route, I need to have a stable GTK+/GDK v3 environment. This appears to not yet be available within CentOS 6, and I'm guessing it might not appear before CentOS 7. Any thoughts here? Is it possible for v3 and v2 to safely co-exist on my CentOS 6 system along with any other essential stuff (glib?)? Is there any documentation available on doing such a dual-version installation? On Arch Linux gtk2 and gtk3 libraries do co-exist. No problem. Worst case you can still ship the libraries itself with your application and add a starter script to set the proper library paths. If your application license is either GPL or LPGL you are also allowed to link statically (afaik), so you can deploy a gtk2 and a gtk3 version. Regards Bernhard Schuster ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: porting Xlib/Motif apps to GTK+
Edit ... so you can deploy a shared and statically linked application binary. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: An issue with Qt styling and/or threads?
What as in a Qt 4.x to 4.y version change that Qt Pixmaps could only be used in the UI thread, and no other thread. This can be considered a bug. If you wrote the code I suggest you to use QImage which can be used anywhere and convert it on the fly to QPixmap, right where you need it to render (not a perfect solution, but the only I know of right now). Regards Bernhard Schuster 2012/2/17 James Tappin jtap...@gmail.com: I have a problem running a Gtk program when using the Qt style as supplied via gtk-qt-engine and kde-config-gtk-style. The program is a fairly heavy duty computation that uses openmp for parallel computation and has a gtk progress monitor (which is updated from within a critical section so it can never be accessed by more than one thread at a time). When the Qt style is selected, the progress bars (gtk_progress_bar) are corrupted and the errors below are displayed repeatedly: (th_run:2015): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed (th_run:2015): Gdk-CRITICAL **: gdk_draw_drawable: assertion `GDK_IS_DRAWABLE (src)' failed (th_run:2015): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed QPixmap: It is not safe to use pixmaps outside the GUI thread QPixmap: It is not safe to use pixmaps outside the GUI thread QPainter::begin: Paint device returned engine == 0, type: 2 QPixmap: It is not safe to use pixmaps outside the GUI thread QPainter::end: Painter not active, aborted The problem does not occur with other Gtk style settings (e.g. Nuvola). I'm not sure if the problem is with the Qt wrapper, Gtk+ or my code. FWIW I'm running Debian stable, with Gtk+ 2.20. Any ideas? James ___ 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
gthreads and gobjects
Happy new year everyone! I need some info on gthread, and how it interacts with gobject based structures which get accessed by multiple threads at a time especially in the respect of deleting objects and signaling and such (I am aware of the basic locking/mutex/conditioning fun :) ) A tutorial on gthread would be welcome too! Thanks for your time! Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Embedding OpenGL into GTK apps
2011/11/30 Almási Dénes denes.alm...@gmail.com: Hi, I would need some clarification on embedding an opengl canvas into a GTK 3.0 application. Is it possible? And if so, how? This is a necessary component for my thesis at university. GtkGlExt (surprisingly - quite out of support) does not seem to work. I even tried to link against it with gtk 2.0, but it doesn't work either. Nasty things like this are written to stdout: (process:9338): Gdk-CRITICAL **: IA__gdk_x11_display_get_xdisplay: assertion `GDK_IS_DISPLAY (display)' failed (process:9338): GdkGLExt-WARNING **: Window system doesn't support OpenGL. I am using Arch linux with GNOME 3, [base], [community] and [extra] repos enabled only, latest nvidia graphics card with proprietary drivers. I am using gtkmm in C++11, but I couldn't achieve anything even in plain gtk, and if a solution exists in gtk, I think it would be portable to gtkmm. Thanks, Dennis P.S.: An equally good solution would be to draw gtk inside an opengl canvas, that way my whole application would be drawn in opengl. Is that possible? I asked this question a while ago at stackoverflow (at that time I were not aware of this mailinglist): http://stackoverflow.com/questions/3815806/gtk-and-opengl-bindings Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem sending double with GDbus
Did you already report the problem to the related bugtracker? Did check if it works wit glibc? Regards Bernhard ___ 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 with window-state-event
2011/11/20 Dipesh Sudershan d1p3shn0...@gmail.com: GdkEventWindowState According to this: http://developer.gnome.org/gdk/stable/gdk-Event-Structures.html#GdkWindowState and http://developer.gnome.org/gdk/stable/gdk-Event-Structures.html#GdkEventWindowState It is as easy as: if (event-new_window_state | GDK_WINDOW_STATE_MAXIMIZED) /* it is maxed */ else /* it is not*/ regards ___ 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 with window-state-event
Screw it, replace the | with an . Sorry screwed this up. Regards ___ 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 with window-state-event
2011/11/20 Dipesh Sudershan d1p3shn0...@gmail.com: On Sun, 2011-11-20 at 11:55 +0100, Bernhard Schuster wrote: Screw it, replace the | with an . Sorry screwed this up. Regards This is working fine. But i still can't solve the problem i have. I have a gtkimage inside an eventbox. the eventbox inside a gtklayout and finally the gtklayout inside a scrolledwindow. When the toplevel window is maximized, i requested for allocated size of the gtkimage, eventbox, gtklayout and scrolledwindow. the allocated sizes were the same as when the window was unmaximized. When the window is maximized, shouldn't the sizes of the childwidgets expand? gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); This is how the scrolledwindow is packed into the main window. To get the size in Gtk 2.x you need to create a workaround as shown in this examples (code I wrote used some time ago for a legacy gtk2 project), size allocation returns not what you desire: http://pastie.org/2892251 http://pastie.org/2892254 In the gtk3 there is a simple function call: http://pastie.org/2892267 Both work just fine Regards Bernhard Schuster ___ 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 with window-state-event
Attach some output of your code please and offload big code pieces to pastie.org, susepaste.org or similar to keep this list readable. Regards Bernhard Schuster ___ 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 with window-state-event
2011/11/20 Dipesh Sudershan d1p3shn0...@gmail.com: On Sun, 2011-11-20 at 12:29 +0100, Bernhard Schuster wrote: 2011/11/20 Dipesh Sudershan d1p3shn0...@gmail.com: On Sun, 2011-11-20 at 11:55 +0100, Bernhard Schuster wrote: Screw it, replace the | with an . Sorry screwed this up. Regards This is working fine. But i still can't solve the problem i have. I have a gtkimage inside an eventbox. the eventbox inside a gtklayout and finally the gtklayout inside a scrolledwindow. When the toplevel window is maximized, i requested for allocated size of the gtkimage, eventbox, gtklayout and scrolledwindow. the allocated sizes were the same as when the window was unmaximized. When the window is maximized, shouldn't the sizes of the childwidgets expand? gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); This is how the scrolledwindow is packed into the main window. To get the size in Gtk 2.x you need to create a workaround as shown in this examples (code I wrote used some time ago for a legacy gtk2 project), size allocation returns not what you desire: http://pastie.org/2892251 http://pastie.org/2892254 In the gtk3 there is a simple function call: http://pastie.org/2892267 Both work just fine Regards Bernhard Schuster I'm using gtk-3.0. gtk_widget_get_allocated width and gtk_widget_get_allocated height are not working. I'm not get getting the size of the child widgets when the main window is maximized. I will try to explain better.. I have a gtkwindow which contains the scrolled window. I have connected configure-event with the gtkwindow and that works fine. I get correct allocated sizeds from the functions mentioned above. But with the window-state-event, i'm not getting correct values. here's the code for the window-state-event handler function.. static gboolean window_state_event_handler(gtkWidget *widget, GdkEventWindowState *event) { if ( event-new_window_state GDK_WINDOW_STATE_MAXIMIZED ) { int width, height; //GtkAllocation allocate; //gtk_widget_get_allocation(currentjob-mw-scrolledwindow,allocate); //width = allocate.width; //height = allocate.height; width = gtk_widget_get_allocated_width(currentjob-mw-layout); height = gtk_widget_get_allocated_height(currentjob-mw-layout); printf(%dx%d\n, width, height); } return FALSE; } Try to make it the callback execute last within the event loop (use the g_signal_connect_run_last or similar), this may fix (totally wild guessing). Regards Bernhard Schuster ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK mailing list
2011/11/14 Michael Cronenworth m...@cchtml.com: It seems the amount of traffic on this list has dropped significantly over the past few years. Is there a better mailing list or web forum to collaborate with others about GTK application development? AFAIK no. The fact there is not much traffic could also mean that pretty much is covered by tutorials, and the docs are pretty good also. Regards Bernhard Schuster ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Keybindings
I think this is what you want, though I am not 100% sure: http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: multiple filters in GtkFileChooser
2011/9/14 Allin Cottrell cottr...@wfu.edu: On Tue, 13 Sep 2011, Allin Cottrell wrote: I have found the relevant difference between gtk 2.24.5 and 2.24.6, which has the effect -- on my system at least -- that the filter selection combo box is not displayed correctly in the gtk file chooser when using 2.24.6. It's the added material in the function filter_create(), in gtkfilechooserdefault.c. I'm attaching a diff (simply commenting out the new stuff), which if applied to 2.24.6 makes it work correctly for me. One further point: I've now tried compiling the same code against GTK 3.0.12, and I'm not seeing the problem with the wrongly ellipsized strings in the filechooser filter combo. GTK 2.24.6 is the only release which exhibits this problem. I have been able to work around the issue with 2.24.6 with a hack: locate the filter combo among the children of the file chooser dialog by recursing gtk_container_foreach(), and use gtk_widget_set_size_request() to set its width to something sensible. I might mention that the installed pango is 1.29.3, in case that makes any difference. -- Allin Cottrell Department of Economics Wake Forest University, NC You should really file a bug report. It's the right thing to do Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: drag'n'drop sample application
2011/9/13 John Emmas john...@tiscali.co.uk: On 11 Sep 2011, at 19:24, John Emmas wrote: src/gtk+-2.20.0/tests/testtreeview.c src/gtk+-2.20.0/prop-editor.c [...] I know there aren't many people here who use gtk-win32 but if anyone does (and can spare a few minutes) could you try building those two modules and see if you can reproduce the problem? I'd like to find out if TreeView dnd is something that isn't working generally in gtk-win32 or if the problem is specific to my copy for some reason. FWIW I came across some old postings I'd made on this mailing list (circa April 2010) and realised that I already flagged up this problem when I was using gtk-win32 v2.14, about 18 months ago. For the past 6 months or so I've been using v2.20 and it still seems to be present in that version although I think gtk is up to about 2.24 now. I'm planning to investigate the TreeView DND issue sometime soon but it'd be handy to know if anyone else is working on it (or if it's already been fixed). To recap, TreeView controls seem to support drag'n'drop if I build them for Linux - but not if I build them for Windows. If anyone has any information that might be helpful I'd really appreciate it. Thanks. Better ask that on the devel list, not on the app-devel_list Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: multiple filters in GtkFileChooser
Can you supply a minimal example where it fails? That would help to find the culprit. I am atm at gtk 2.24.6 so if you can post that I give it a run... Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: multiple filters in GtkFileChooser
2011/9/13 Allin Cottrell cottr...@wfu.edu: On Tue, 13 Sep 2011, Bernhard Schuster wrote: Can you supply a minimal example where it fails? That would help to find the culprit. I am atm at gtk 2.24.6 so if you can post that I give it a run... Thanks! I'm attaching a minimal case. Allin Cottrell For me it looks perfectly ok, no abbreviations, tripple dots. I does the right thing. Maybe you got a screwed up gtk theme or something. Note: I do not know how much the fact I am running gnome3 (fallback mode) does influence the rendering part of a gtk pplication compiled against the 2.24.6 shared libraries. Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GList empty after iteration?
2011/9/12 Craig craigbakal...@verizon.net: Hi All, I am confused about GList. My application is parsing a file and creating midi data with it. I am using GList to store the midi data. I have created a GtkListStore to view the parsed data (to insure I am parsing the data properly). So, below I iterate through the GList and copy the data into a tree view. But, I am shocked to see that after I iterate through the GList, I cannot iterate through the list again. I have debugged the list after the iteration with g_list_length(events) which shows the list length at 0. What is up with this? The first while loop has data, the second while loop has not data. The code is below-- GtkTreeIter tree_iter; events = g_list_reverse(events); shallowcopy = events; events = g_list_first(events); while(events) { gtk_list_store_append (list_store, tree_iter); struct midi_event *me = events-data; gtk_list_store_set(list_store, tree_iter, 0, me-time_stamp, 1, me-event_type, 2, me-message1, 3, me-message2, -1); events = g_list_next(events); } /// this is where the list appears to be empty events = shallowcopy; while(events) { g_print(midi event \n); events = g_list_next(events); } Thanks for any help! Your first loop ands when your event is zer0. Youn need to use a second pointer for your second iteration which still points to the first item in the actual list. Hope that helps. Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Extend IconView clickable area
2011/9/10 Jonas H. jo...@lophus.org: On 09/03/2011 01:56 PM, Jonas H. wrote: On 08/26/2011 09:12 PM, Jonas H. wrote: Hello list, how can I extend the clickable area of a text column in a one-columned IconView (whose item width is greater than the text itself)? Illustration: http://jonas.lophus.org/iconview.png I want the red rectangle to be clickable, too, having the same effect as clicking on the hello 1 texdt. I'm using Python + GObject introspection but I wouldn't mind doing this in C either. Thanks, Jonas *bump* anyone? never used iconview so far... can't help you here. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkBuilder bugs
2011/9/5 Tristan Van Berkom t...@gnome.org: On Mon, Sep 5, 2011 at 12:43 PM, Michal Suchanek hramr...@centrum.cz wrote: On 5 September 2011 11:29, Tristan Van Berkom t...@gnome.org wrote: On Mon, Sep 5, 2011 at 10:49 AM, Michal Suchanek hramr...@centrum.cz wrote: On 4 September 2011 12:32, Tristan Van Berkom t...@gnome.org wrote: Its a bug that needs to be fixed in Glade. You can remove the line that says n-rows safely fwiw I don't think that an extra property would break the widget, the warning should be harmless. Anything that GtkBuilder encounters that is unrecognized (unrecognized xml tags, properties and even unknown/inexistant GObject properties) cause GtkBuilder to either abort or fail to parse. For me unknown properties are just ignored, at least in gtk 2. Ah my bad, indeed only a warning is issued for a misplaced property (the warnings which the Bernhard originally mentioned). Only a warning, not an error. Just curious because my widgets did not show up, but that was caused by GtkBin not drawing _anything_. In gtk2 it did, and the gtk3 docs do not mention it that there is no drawing method implemented. Removing the mentioned lines indeed fixed the warning. The glade version I spawned my .ui xml file from is the following: $ glade --version glade 3.10.0 Thanks for the quick response Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkBuilder bugs
I am using a gtk-builder file for my application, which uses a Grid widget for layouting. When I run the application, I read this: Gtk-WARNING **: Unknown property: GtkGrid.n-rows and the grid is not shown (nor its contents) Thanks for any tips Regards Bernhard Schuster ___ 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 achieve functionality of GTK_WINDOW_POPUP but with keyboard input
2011/8/30 Andrew Wood a@me.com: How can I achieve the same 'screen invasion' effect (i.e covers everything including the Gnome Panels and prevents other windows being brought to the front with Alt-Tab) that GTK_WINDOW_POPUP has but also allow keyboard input to the widgets in the window. Ive tried GDK_WINDOW_TYPE_HINT_DOCK which invades screen ok but has no keyboard input GDK_WINDOW_TYPE_HINT_SPLASHSCREEN doesnt invade screen - other windows can be placed on top, alt-tab works, but keyboard input works GDK_WINDOW_TYPE_HINT_DESKTOP no display GDK_WINDOW_TYPE_HINT_UTILITY doesnt invade screen - other windows can be placed on top, alt-tab works GDK_WINDOW_TYPE_HINT_TOOLBAR doesnt invade screen - other windows can be placed on top, alt-tab works GDK_WINDOW_TYPE_HINT_MENU doesnt invade screen - other windows can be placed on top, alt-tab works The reason is Im trying to write a program for a public kiosk hence I effectively want to lock the screen. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list gtk_window_fullscreen (window) - either just disable all hotkeys within your DE environment or - run a bare X server without a DE (see xinit) Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: rebuilding widget
2011/8/4 Pavol Klačanský pa...@klacansky.com: Hi, I have EvnetBox and in it I have all content of one tile, but I need refresh it (destroy and build) and I don't know how :/ Provide more information, noone can help you with the only information being supplied being GtkEventBox and refresh Regards Bernhard Schuster ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk-app-devel-list Digest, Vol 87, Issue 18
use gist.com, it's way more readable and does not spam the mailinglist that much... Read up g_signal_handler_block/unblock, that should be what you need to in order to block signals at specifc point of time. Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk-app-devel-list Digest, Vol 87, Issue 18
I am sorry, wrong link, meant this one: https://gist.github.com/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Aliasing / Blurring
I am in the position to write an application which needs to be able to identify single pixels of a picture. Currently my implementation (based on Gtk+ 3.x) uses GtkDrawingArea with a cairo surface. Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: g_win32_get_package_installation_directory_of_module()
http://www.gnu.org/s/hello/manual/libc/System-Calls.html I don't know if this helps, but maybe it is avail there, if not just use regular system call sh/bash cmd to get the directory (given your program can access a shell) Regards drahnr ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Help with closing a notebook page (GTK2)
Did it within a pet project of mine and works pretty well,, it's GPL just in case you'd like to have a ook at real code: https://gitorious.org/tinygecko Regards Bernhard ___ 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 login progressbar
my app connect database, it show login dialog first, after connected, it distory the login dialog and come in main loop, show main window. i want add a progressbar in login dialog, but at that time it doesn't in main loop , how can i refresh the progressbar by using timeout function? I'd rather enter the mainloop and run your connection dialog from there, and when connection succeeded just connect a callback and spawnyour mainwindow there. Regards ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkNotebook with action on click of special tab
In the end it was as easy as replacing g_signal_connect with g_signal_connect_after Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: multiple tree views
2011/5/3 Pavol Klačanský pa...@klacansky.com: V Nedeľa, 1. máj 2011 o 15:59 +0200, Colomban Wendling napísal(a): Hi, Le 01/05/2011 15:03, Pavol Klačanský a écrit : Hi, I need in my about 5 and more treeviews. I created one using glade, but I don't know how can I use it multiple times, gtk says something like this (client:25913): Gtk-WARNING **: Attempting to add a widget with type GtkTreeView to a container of type GtkHBox, but the widget is already inside a container of type GtkHBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget. You cannot pack a widget at more that one place at a time, you'll need to create 5 tree views. Though, if you want to display the same content in more than one tree view, you can share the TreeModel IIRC. Regards, Colomban ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Hi, and can I create tree in Glade and use it as template? or Do I have to generate them in code? I wanna separated trees with separated storage ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list just keep spawning treeviews from your gladefile. Think of it as a building plan, not as an identifyable object. The result of building according the glade file plan will be aunique object. Hope that helps. Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkNotebook with action on click of special tab
Easiest way is to check it out yourself: g...@gitorious.org:tinygecko/devel.git Its not big and a simple make does it all for you :) dependencies are gtksourceview and gtk+2.0 Thank you for your time, I already implemented pretty much of what you said, I am just struggling about this focus issue. Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkNotebook with action on click of special tab
Now I am adding a a new page on the switch-page signal. It works well so far BUT I got a focus problem. No matter if I try to focus it via gtk_notebook_set_current_page instantly after adding the page, or in a function glued to the signal page-added, the clicked tab will show up. So is there any tipp you can give me to achieve the effect I desire? Thanks for any hint(s)! Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkNotebook with action on click of special tab
2011/4/27 Bill Czermak czer...@netspace.net.au: Hi Bernhard Checked my code and last updated my notebook handling source last November. Probably written 6 months earlier, and changes were to restructure the way I was using GTK, rather than change the notebook handling area. So I might have forgotten a few implementation problems I solved at the time I only use the switch-page signal and it displays fine for me (GTK2 on Ubuntu 10.10). Dont use any other signals to handle notebook pages. Set current page works as expected for me. I recall I had a problem in that if no data was displayed on the page, then the new page was not displayed... not what I expected, but fixed by setting up some data on the page. I had this issue too, but that was easy to fix. Some pesudocode to clearify: callback on page-switched: { create tab label create tab child show label show child spawn new tab set the recently spawn tab to be the new current tab } The crux lies in the fact (I think) that this callback gets executed on page-switch which itself changes the current tab What I need this for? Imageine a plus on the last tab, as soon as you click that tab head, a new tab with some other content spawns. (Just in case someone cares) Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Compile time GTK+ 3 version check
2011/4/24 David Nečas y...@physics.muni.cz On Sun, Apr 24, 2011 at 11:11:58AM +0900, Tristan Van Berkom wrote: Anyway, with a good VCS you should be able to easily maintain an old GTK+2 branch of your project and easily backport the fixes which apply from your new GTK+3 branch back into the old source base (and avoid the whole #ifdef mess easily enough). This might be convenient for the developer but this convenience is achieved by distributing the burden to users that will have to decide which version to download – an this will be unclear to many. Yeti You can do a shellscript, check which version and run the proper excutable. This requires to always ship both versions but will work pretty much out. Another option is to put in one binary file which has a runtime switch to jump to one or another code section (I am not very familiar with this and may be not that much fun at all). Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkNotebook with action on click of special tab
2011/4/20 Tristan Van Berkom t...@gnome.org On Wed, Apr 20, 2011 at 8:34 AM, Bernhard Schuster schuster.bernh...@googlemail.com wrote: Hi I am trying to achieve the effect of new tab openening if one tab gets selected. Unfortunaltly the doc is very sparse on that: http://developer.gnome.org/gtk/stable/GtkNotebook.html as of using the select-page signal. Can anyone give me a hint how to use it properly with a g_signal_connect function? Note: I am still in a learning phase so please be patient with me :) What I tried so far: gboolean derived_notebook_insert_page (DerivedNotebook *obj, gboolean b, gpointer data) { // do page insert } and within foo_derived_notebook_init: g_signal_connect (obj, select-page, G_CALLBACK (derived_notebook_insert_page), NULL); If anybody could shed some light of what the return value is for, and how to achiev what I want, thanks very much Hi, First of all if you are deriving the notebook, you should not connect a signal handler but instead override the class vfunc (in this case would be GtkNotebookClass-select_page). Also, select-page is generally a keybinding signal used to move focus (it's used when one of the tabs have keyboard focus and spacebar is pressed to make that tab's page the current page, the return value I believe is whether the notebook keeps focus or not). Probably you want to use the switch-page vfunc which will be called to do the work of actually changing the current page (whether it's done by code or by user interaction, so you might have to be careful to avoid recursion here). Also, I have a hard time imagining how it would be desirable to open a new tab as a result of selecting a different tab (maybe some more context here would let us give you better advice). Texteditor, where the last tab head is just a plus and the tab content is never expected to be visible. The tab head is GtkImage showing GTK_STOCK_ADD. On click its expected to spawn a new tab let of the special one and gets focused instantly. Thanks for your tipp! B. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkNotebook with action on click of special tab
Hi I am trying to achieve the effect of new tab openening if one tab gets selected. Unfortunaltly the doc is very sparse on that: http://developer.gnome.org/gtk/stable/GtkNotebook.html as of using the select-page signal. Can anyone give me a hint how to use it properly with a g_signal_connect function? Note: I am still in a learning phase so please be patient with me :) What I tried so far: gboolean derived_notebook_insert_page (DerivedNotebook *obj, gboolean b, gpointer data) { // do page insert } and within foo_derived_notebook_init: g_signal_connect (obj, select-page, G_CALLBACK (derived_notebook_insert_page), NULL); If anybody could shed some light of what the return value is for, and how to achiev what I want, thanks very much Regards B. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list