Re: examples/list.c
look for and use the gtk-demo application thats normallu apart of the devel package. It contains current GTK examples pre-compiled with source immediately available. Also, consider using devhelp, another api document viewer for GTK/GLIB and many others. James, On Wed, 2009-01-21 at 21:42 +, Dave Luttinen wrote: 2nd post. I'm just getting warmed up g. Compile with supplied Makefile to gtk+/gtk+-2.14.6/examples/list.c, run sample application, right click on list, the following is printed: (list:17088): Gtk-CRITICAL **: gtk_list_add: assertion `GTK_IS_LIST_ITEM (widget)' failed (list:17088): Gtk-CRITICAL **: gtk_widget_get_parent_window: assertion `GTK_IS_WIDGET (widget)' failed (list:17088): Gdk-CRITICAL **: gdk_window_get_children: assertion `GDK_IS_WINDOW (window)' failed (list:17088): Gtk-CRITICAL **: gtk_widget_get_parent_window: assertion `GTK_IS_WIDGET (widget)' failed ** ** Gtk:ERROR:(/build/buildd/gtk+2.0-2.12.9/gtk/gtkwidget.c:4810):gtk_widget_reparent_fixup_child: assertion failed: (client_data != NULL) Aborted I have placed these gtk examples in my home folder my-projects and they compile without complaint. Is this a linking issue? What is occurring? Dave ___ 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: some erros
Frederico, From your code listing part of your problem could be this syntax error: gtk_file_chooser_add_filter(*chooser, *filtro); it should read; gtk_file_chooser_add_filter(chooser, filtro); James, On Thu, 2009-01-15 at 22:58 -0200, frederico schardong wrote: Hi, anybody can help me to resolve this? GtkFileFilter *filtro; GtkWidget *chooser; //GtkFileChooser *chooser; gtk_file_filter_set_name(filtro,bmp); chooser = gtk_file_chooser_dialog_new (Open File, parent_window, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_add_filter(*chooser, *filtro); gtk_widget_show(chooser); if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); g_print (filename); } gtk_widget_destroy (chooser); how I can add filter to my chooser?? thanks ___ 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: Question about Callback
Rudolfo, In your case where you have multiple buttons operating on the same logical data field, using a single callback function is very practical. The same can be said for a callback that performs a single logical function, all windows/object should attempt to reuse that callback if they need that functions. Example; being a pair of callback I wrote that is called when a window is hidden or shown. All my dialogs/windows that need that service reuse those single callbacks. To handle the fact that each window instance saves its visibility value in a different variable/address, I pass into the g_signal_connect(..., b_visible) the address of that variable when creating each window. void cb_main_interface_show (GtkWidget * widget, gboolean *pb_visible) { g_return_if_fail (pb_visible != NULL); *pb_visible = TRUE; } void cb_main_interface_hide (GtkWidget * widget, gboolean *pb_visible) { g_return_if_fail (pb_visible != NULL); *pb_visible = FALSE; } To me this helps organize the code and makes it easier to maintain. The cost of this reuse is fairly low, and the g_object_[set|get]_data() along with user-data cb_id flags, normally handles it well. Of course all this reuse can be impacted by the to many global/static variables -- which limits the re-entrancy or reuse of any program. My two. James, On Tue, 2009-01-13 at 20:40 +0100, Rudolfo Pinewood wrote: Hi, thanks for your answer. I think I understand my code a bit better now... I wonder whether it is best practice to use static functions for these callbacks - in my code it is actually a member function (because of having many different buttons whose states form a bitfield that is compressed to one int value. I did not find any example that does not use such static functions. Greetings, Christoph Hartwig James Scott Jr schrieb: You can also use: - in the routine that creates the button, save a unique value. g_object_set_data(G_OBJECT(button), Unique-Key, some-value) -in button callback routine, retrieve the unique value. some-value-pointer = g_object_get_data(G_OBJECT(button), Unique-Key); This in addition to any pre-allocated memory structure you passed in the g_signal_connect(), or g_signal_connect_swapped(). The issue with reuse of button callbacks is always how to determine which button! I do two things; 1. pre-allocate a memory structure with the first value a fixed id of some sort (or related to the button's function). example #def EXIT_BUTTON_FLAG 1 . . . typedef struct _SomeButton { gint cb_id; ... } SomeButton, *PSomeButton; . . . PSomeButton memButton = NULL; . memButton = g_new0(SomeButton, 1); memButton-cb_id = EXIT_BUTTON_CBID; . g_signal_connect(G_OBJECT(button), toggled, G_CALLBACK(fn_callback), memButton); . . 2. g_object_set_data() and g_object_get_data() as described earlier. checking the cb_id of the userdata from g_signal... and also getting this extra value helps your positively identify which button was pressed. Either method will work, but sometimes both come in handy. Hope that helps. Also, here is a link to source code that may help explain better. http://mysite.verizon.net/ressgdw8/sitebuildercontent/sitebuilderfiles/gtkstatusicon-starter-program-0.1.0.tar.bz2 And don't forget to review 'gtk-demo', it has good examples. James, On Sun, 2009-01-11 at 12:42 +0100, Rudolfo Pinewood wrote: Hi, I have a question regarding Callback functions for Toggle buttons. I have several togglebuttons, that are all registered to call one specific function (ApplyFlags). In this function I actually don't know which button was activated. My attempt was giving each button/callback an additional parameter that should be passed to my ApplyFlags function. However I was not able to do so - MemberCaller1 seems to fit (regarding the call one function with one parameter) but I did not manage to get my parameter into that Callback in g_signal_connect_swapped(G_OBJECT(button), toggled, G_CALLBACK(callback.getThunk()), callback.getEnvironment()). How could this be done? Thanks in advance Christoph Hartwig ___ 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: Howto correctly generate expandable void?
Till, I have not tested this yet, but I can give you an ideal of what I would try first. Window -vbox -- vbutton_box(a,b,c) -- postioned using start -- vbutton_box(x,y,z) -- postioned using end Here is the code. ***BEGIN /* Button Alignment */ #include gtk/gtk.h int main(int argc, char *argv[] ) { GtkWidget *window = NULL; GtkWidget *vbox = NULL; GtkWidget *button = NULL; GtkWidget *bbox= NULL; gtk_init (argc, argv); /* create window, etc */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), expandable void); gtk_container_set_border_width (GTK_CONTAINER (window), 5); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (gtk_main_quit), NULL); /* * Create the main vbox */ vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (window), vbox); /* * Create the Top Group of buttons */ bbox = gtk_vbutton_box_new (); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); gtk_box_set_spacing (GTK_BOX (bbox), 6); gtk_box_pack_start (GTK_BOX (vbox), bbox, TRUE, TRUE, 5); button = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_container_add (GTK_CONTAINER (bbox), button); button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_container_add (GTK_CONTAINER (bbox), button); button = gtk_button_new_from_stock (GTK_STOCK_HELP); gtk_container_add (GTK_CONTAINER (bbox), button); /* * Create the Bottom Group of buttons */ bbox = gtk_vbutton_box_new (); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END); gtk_box_set_spacing (GTK_BOX (bbox), 6); gtk_box_pack_end (GTK_BOX (vbox), bbox, TRUE, TRUE, 5); button = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_container_add (GTK_CONTAINER (bbox), button); button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_container_add (GTK_CONTAINER (bbox), button); button = gtk_button_new_from_stock (GTK_STOCK_HELP); gtk_container_add (GTK_CONTAINER (bbox), button); gtk_widget_show_all (window); gtk_main(); return 0; } ***END On Fri, 2008-10-24 at 21:01 +0200, Till Harbaum / Lists wrote: Hi, i have a vbox with a bunch of buttons. I want some of them to appear at the top and some of them at the bottom. The buttons should not be expanded and the space between them should also not expand except the space between the two groups. Something like this: (a) (b) (c) (x) (y) (z) How is this done correctly without having some invisible item i can place between both groups and which is set to expand/fill? Till ___ 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: Forking from Gtk
G, I've seen most of the other responses, and better understand what you are trying to do. And like others -- fork() is not recommended. I had similar problem and resolved it in this codeset. http://gfhcm.sourceforge.net -- a monitor for the [EMAIL PROTECTED] project First, like you I needed to start several executables in the background, resolve their identify via pid number, and monitor their cpu utilization and associated artifacts to gage their progress. I approached it two ways: with standalone gfhcm, and then in client/server way using gfhcmc gfhcmd; gfhcmc is the gtk gui and gfhcmd is a glib helper daemon. For your issue: I suggest g_[a]sync_command_line() as a way to launch a background process from a gtk app. Then using either ipc Queues, pipes, or sockets to connect to process to echange commands and information. Having a formal daemon will help the issue of starting/stopping the background thread. and Finally a dedicated gui that expects to use an IPC to communication with the process. Anyway that you would like to proceed - I think we all can offer solutions. But be clear, I and maybe we think, forking is a bad ideal for GTK program period. My website may have something of interest: http://mysite.verizon.net/skoona/id2.html James, On Tue, 2008-07-08 at 06:51 +0200, G Hasse wrote: On Mon, Jul 07, 2008 at 10:58:36PM -0400, James Scott Jr wrote: G, The basic design decision to use fork() as a way to do work in the background flawed. fork()ing is not practical for gtk program. While fork() has been a valid option for many non-gui programs in the absence of threads, either g_thread_create() or pthread_create(). Today it is not very useful -- as in stop doing it now! Consider instead using a valid multi-threaded implementation like g_threads_xxx() for GTK based programs. Or if full multi-threading is not required, look at g_timeout_add() which is a background timer routine that can serve as one or more background execution units; neatly inside an gtk context. This is not a very practical solution if I want to quit the gtk program and go home... The example I gave was just an example. I want to create a process that run for a VERY long time. (a week). And to have the GUI running allong is not a solution. This process don't need to communicate with the GUI. And if so I can connect to the process with a socket and ask for services. $ devhelp $ gtk-demo The above two program you be pre-installed on your Linux machine: devhelp has the gtk and glib api documentation, and gtk-demo shows you many of the gtk/glib features in action. Having said the multi-thread phrase, here is another word of caution. In GTK only the main or ONE thread can safely interface with GTK api calls that change the display. Using more than one thread to call gtk apis at the same time will fail or cause a sigfault. The context of GTK being your front-end to X11 is the source of this none-thread-safe-caution; it is in how gtk MUST interact with X that placing the multi-thread restriction. There are elegant work-arounds this issue. Here is a link to the classic FAQ answer on Multi-threaded GTK programs: http://library.gnome.org/devel/gtk-faq/stable/x482.html Regards, James, Tanks for your answer but I don't thing threads is the solution in my case. On Mon, 2008-07-07 at 23:03 +0200, G Hasse wrote: Hello, I have a small demo app. This works on FreeBSD but I can't get to work on Linux. I know that in Linux setsid will fail if the child has the same session_id as the parent. So on Linux you must fork twice. But it also seems that the parent must do an exit. And I don't want that. The code is not very long - so I include it here. ---snipp--- //-- // // $Id: GtkFork.c,v 1.2 2008/07/07 20:29:17 gorhas Exp $ // // Experiment to run a thing in background // This works on FreeBSD but not on Linux... // // Build with // // CFLAGS := `pkg-config glib-2.0 --cflags` `pkg-config gtk+-2.0 --cflags` // LDFLAGS := `pkg-config glib-2.0 --libs` `pkg-config gtk+-2.0 --libs` // // cc $(CFLAGS) -o GtkFork GtkFork.c $(LDFLAGS) // //-- #include gtk/gtk.h #include stdlib.h #include stdio.h #include time.h #include string.h //-- // run_btn_callback // // Try to run something in the background // //-- static void run_btn_callback (GtkWidget *button, gpointer data) { int loops_to_run = 0; int i = 0; int pid = -1; int ret = -1; // Skriv ut innehållet på skärmen printf(Clicked..\n); printf
Re: Forking from Gtk
On Tue, 2008-07-08 at 23:23 +0200, G Hasse wrote: On Tue, Jul 08, 2008 at 01:52:00PM -0400, James Scott Jr wrote: G, I've seen most of the other responses, and better understand what you are trying to do. And like others -- fork() is not recommended. I can't belive this... Certanly a forground process must be able to start a process that completly detatch from the parent. Gtk or not it could not matter. If I fork a Gtk program I migt have a lot of GtkWidget pointers that are of no use - but if I bother I should be able to free those. The gtk_main loop runs around to find out if signals have been emitted. So if I exit this loop no sutch activity should be going on. I have been doing this on FreeBSD for a long time and I have no problem there. The only problem I realy have on Linux is that the forked process is marked as defunct and probably take a process slot until the parent exits. In FreeBSD I don't notice this behaviour. The cenario you tell below is not quite applicable since my program don't know in advance what should be run. I only need the Gtk program to set a lot of parameters and then fire of the process. I klient server, socket or pipe solution would just make the solution more complicated. And I don't need to minitor the processes during calculation. I had similar problem and resolved it in this codeset. http://gfhcm.sourceforge.net -- a monitor for the [EMAIL PROTECTED] project First, like you I needed to start several executables in the background, resolve their identify via pid number, and monitor their cpu utilization and associated artifacts to gage their progress. I approached it two ways: with standalone gfhcm, and then in client/server way using gfhcmc gfhcmd; gfhcmc is the gtk gui and gfhcmd is a glib helper daemon. For your issue: I suggest g_[a]sync_command_line() as a way to launch a background process from a gtk app. Then using either ipc Queues, pipes, or sockets to connect to process to echange commands and information. Having a formal daemon will help the issue of starting/stopping the background thread. and Finally a dedicated gui that expects to use an IPC to communication with the process. Anyway that you would like to proceed - I think we all can offer solutions. But be clear, I and maybe we think, forking is a bad ideal for GTK program period. Sorry. I don't se this. What i see is forking from a foreground process and letting the foreground process still live on is a bad idea on *LINUX*. Or... Göran Ok, the glib/gtk apis can be used to meet the processing conditions you describe. I note that you aware of the increased complexity caused by a design different from what your accustomed to on BSD. I think those of us who have done a bit of gtk programming in varied situations, see a solution that does require more effort and design. John jcupitt stated that he got your code to work on Ubuntu with a few minor additions. And I presume, using some type of gui toolkit on BSD you been doing this for a while. So with John's comment and your experience, I think you can take it from here and use fork(). However, if you want to redesign to take full advantage of the resources and capability of GTK/GLIB and LINUX for the benefit of your users experience; I got some time and would be willing to help you build a framework -- just send me code or specs to look at. The design changes to redo your code are not complicated or burdensome; just different. I think the outcome of the rework will be a better piece of software with greater opportunity to please your users - even if the user is only you. James, My website may have something of interest: http://mysite.verizon.net/skoona/id2.html James, On Tue, 2008-07-08 at 06:51 +0200, G Hasse wrote: On Mon, Jul 07, 2008 at 10:58:36PM -0400, James Scott Jr wrote: G, The basic design decision to use fork() as a way to do work in the background flawed. fork()ing is not practical for gtk program. While fork() has been a valid option for many non-gui programs in the absence of threads, either g_thread_create() or pthread_create(). Today it is not very useful -- as in stop doing it now! Consider instead using a valid multi-threaded implementation like g_threads_xxx() for GTK based programs. Or if full multi-threading is not required, look at g_timeout_add() which is a background timer routine that can serve as one or more background execution units; neatly inside an gtk context. This is not a very practical solution if I want to quit the gtk program and go home... The example I gave was just an example. I want to create a process that run for a VERY long time. (a week). And to have the GUI running allong is not a solution. This process don't need to communicate with the GUI. And if so I can connect to the process with a socket and ask for services
Re: Forking from Gtk
G, The basic design decision to use fork() as a way to do work in the background flawed. fork()ing is not practical for gtk program. While fork() has been a valid option for many non-gui programs in the absence of threads, either g_thread_create() or pthread_create(). Today it is not very useful -- as in stop doing it now! Consider instead using a valid multi-threaded implementation like g_threads_xxx() for GTK based programs. Or if full multi-threading is not required, look at g_timeout_add() which is a background timer routine that can serve as one or more background execution units; neatly inside an gtk context. $ devhelp $ gtk-demo The above two program you be pre-installed on your Linux machine: devhelp has the gtk and glib api documentation, and gtk-demo shows you many of the gtk/glib features in action. Having said the multi-thread phrase, here is another word of caution. In GTK only the main or ONE thread can safely interface with GTK api calls that change the display. Using more than one thread to call gtk apis at the same time will fail or cause a sigfault. The context of GTK being your front-end to X11 is the source of this none-thread-safe-caution; it is in how gtk MUST interact with X that placing the multi-thread restriction. There are elegant work-arounds this issue. Here is a link to the classic FAQ answer on Multi-threaded GTK programs: http://library.gnome.org/devel/gtk-faq/stable/x482.html Regards, James, On Mon, 2008-07-07 at 23:03 +0200, G Hasse wrote: Hello, I have a small demo app. This works on FreeBSD but I can't get to work on Linux. I know that in Linux setsid will fail if the child has the same session_id as the parent. So on Linux you must fork twice. But it also seems that the parent must do an exit. And I don't want that. The code is not very long - so I include it here. ---snipp--- //-- // // $Id: GtkFork.c,v 1.2 2008/07/07 20:29:17 gorhas Exp $ // // Experiment to run a thing in background // This works on FreeBSD but not on Linux... // // Build with // // CFLAGS := `pkg-config glib-2.0 --cflags` `pkg-config gtk+-2.0 --cflags` // LDFLAGS := `pkg-config glib-2.0 --libs` `pkg-config gtk+-2.0 --libs` // // cc $(CFLAGS) -o GtkFork GtkFork.c $(LDFLAGS) // //-- #include gtk/gtk.h #include stdlib.h #include stdio.h #include time.h #include string.h //-- // run_btn_callback // // Try to run something in the background // //-- static void run_btn_callback (GtkWidget *button, gpointer data) { int loops_to_run = 0; int i = 0; int pid = -1; int ret = -1; // Skriv ut innehållet på skärmen printf(Clicked..\n); printf(Data was: %s\n, gtk_entry_get_text( data )); loops_to_run = atoi( gtk_entry_get_text(data)); // We dont want to wait very long... if( loops_to_run 60 ) { loops_to_run = 60; printf(Adjusting to 60 loops...\n); } printf(Loops to run: %d\n, loops_to_run ); printf(We make a daemon\n); if ( ( pid = fork() ) 0 ) { // Something went wrong printf(We could not fork just exit); exit(-1); } else if ( pid != 0 ) { // This is the parent process printf(The background process have pid: %d\n, pid); return; } // Quit gtk gtk_main_quit(); // Become session leader ret = setsid(); if( ret == -1 ) { perror(We could not be session leader\n); exit(-1); } // Set umask for safety umask(0); // Set root dir chdir(/); for( i = 0; i loops_to_run; i++ ) { printf(We are running: %d\n, i ); sleep(1); } exit(0); } //-- // When we quit //-- static void quit_callback() { gtk_main_quit (); } //-- // main // // Creates a gtk windows to specify how many loops // the daemon should run. // //-- int main (int argc, char **argv) { GtkWidget *mainwin = 0L; GtkWidget *number_entry = 0L; GtkWidget *run_btn = 0L; GtkWidget *vbox = 0L; /* Initialize i18n support */ printf(Locale is: %s\n, gtk_set_locale () ); /* Initialize the widget set */ gtk_init (argc, argv); /* Create the main window */ mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL); /* Set up our GUI elements */ vbox = gtk_vbox_new (FALSE, 0); number_entry = gtk_entry_new(); run_btn =
Re: Draw in a GdkPixbuf
Ok, http://cairographics.org/examples/ http://live.gnome.org/GtkCairoIntegration These links have some examples of using everything from a raw image to a pdf as the backend in cairo from the command line -- without the use of gtk. Hope this fits your need better than my last response. James, On Thu, 2008-05-29 at 03:18 +0200, Luis Menina wrote: Hi list! I'm trying to find a way to draw in a GdkPixbuf (for example draw a rectangle on the pixbuf) and save the result to a file afterwards. I found in devhelp the gdk_draw_* functions, but to use them I need a GdkPixmap. gdk_pixmap_new requires a GdkDrawable. The problem is that I'm developping a command line application, so I don't use GTK, only glib, gdk, and gdk-pixbuf. Even creating the GdkPixmap with a NULL GdkDrawable, I can't workaround the problem, because the documentation of gdk_draw_pixbuf tells me that All windows have a colormap, however, pixmaps only have colormap by default if they were created with a non-NULL window argument. Otherwise a colormap must be set on them with gdk_drawable_set_colormap(). Trying to get a colormap requires other stuff, which requires other stuff, and so on... As this seems to be quite old-fashioned way of doing things, I tried to see if cairo could do the trick. But it seems there's no way to draw to a GdkPixbuf with cairo (I'm unfamiliar with cairo). So, does anyone have an hint on how to draw and save an image from a GdkPixbuf, with gdk or cairo ? Thanks for you help, Luis ___ 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: Draw in a GdkPixbuf
Take a look at the executable 'gtk-demo'. It should have been installed with gtk's development tools; i.e. already loaded on you machine. Hint: double click the sample for a live preview, then look at the source code. Additionally, here is a link to glinegraph, a simple line graph widget written twice, once in gdk and again in cairo. http://sourceforge.net/project/showfiles.php?group_id=157888package_id=191712 James, On Thu, 2008-05-29 at 03:18 +0200, Luis Menina wrote: Hi list! I'm trying to find a way to draw in a GdkPixbuf (for example draw a rectangle on the pixbuf) and save the result to a file afterwards. I found in devhelp the gdk_draw_* functions, but to use them I need a GdkPixmap. gdk_pixmap_new requires a GdkDrawable. The problem is that I'm developping a command line application, so I don't use GTK, only glib, gdk, and gdk-pixbuf. Even creating the GdkPixmap with a NULL GdkDrawable, I can't workaround the problem, because the documentation of gdk_draw_pixbuf tells me that All windows have a colormap, however, pixmaps only have colormap by default if they were created with a non-NULL window argument. Otherwise a colormap must be set on them with gdk_drawable_set_colormap(). Trying to get a colormap requires other stuff, which requires other stuff, and so on... As this seems to be quite old-fashioned way of doing things, I tried to see if cairo could do the trick. But it seems there's no way to draw to a GdkPixbuf with cairo (I'm unfamiliar with cairo). So, does anyone have an hint on how to draw and save an image from a GdkPixbuf, with gdk or cairo ? Thanks for you help, Luis ___ 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: Creating a non-focused window
Tom, The word hint almost always refers to a potential capability of the Window Manager; meaning the wm does not have to honor the request or feature. Maybe your code is working and the wm is ignoring the request! There might be a bug in gtk, however I would want to try a different wm or something like xfce or kde, before going down the path. James, On Sat, 2008-05-24 at 14:40 -0400, Keith Maika wrote: Just throwing out a guess here, but could it be that the hint only works on secondary windows? Meaning, maybe the first window an app opens gets focus and the hint is ignored, but subsequent windows work? Not able to test myself currently, just a thought I had. Keith. Tom Machinski wrote: On Fri, May 23, 2008 at 5:41 PM, Bill O'Connor [EMAIL PROTECTED] wrote: I can't make this work in either lang. I can check that the flag is being set with gtk_window_get_focus_on_map(), but it just doesn't do anything. My suggestion is that you not do this. g Thanks for checking, Billy. I'm not going to give up so easily, especially given the fact that GTK+'s developers saw fit to provide that option. Unless all of us here on this thread missed something, this looks like a bug in GTK+ gtk_window_set_focus_on_map() method, and as such should be reported and fixed. Thanks, Tom -- Billy O'Connor ___ 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: Creating a non-focused window
Tom, This might be a opportunity to explore and use 'libnotify' and have a libnotify-popup present your message. As for your original question, I don't have an answer that I treid and know for certain will work. However, This is what I would try by changing my code; 1. I would reread the gtk api to understand if gtk_widget_show() vs gtk_widget_show_all() vs gdk_window_present() would make the messagebox/window visible without redirecting focus. Otherwise, I would disable-focus, show the window, re-enable focus. On the other hand, libnotify should like the best way to proceed. Here is a quick sampler. James, ** required rpms: yum install libnotify libnotify-devel BEGIN CODE: /* notice.c Compile Command: $ gcc `pkg-config --cflags --libs libnotify` -o notice notice.c Usage: $ ./notice -s 5 -t title of messagebox -m message in the box or $ ./notice --help */ #include libnotify/notify.h /* cmd line var pointers */ static gchar *gd_pch_title; static gchar *gd_pch_body; static gchar *gd_pch_icon; static gint gd_i_seconds; int main(int argc, char * argv[] ) { NotifyNotification *nctx; GError *gerror = NULL; GOptionContext *context = NULL; /* --help message for command line */ GOptionEntry entries[] = { {title, 't', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, gd_pch_title, Title text on msg box, Title goes here!}, {message, 'm', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, gd_pch_body, Message body text, message}, {icon-name, 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, gd_pch_icon, icon to include next to message, gtk-dialog-info ...-warning ...-error}, {show-seconds, 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT, gd_i_seconds, seconds to display message, 10}, {NULL} }; /* Get command line parms */ context = g_option_context_new ( - Commandline Notification Utility GPL2 [2008] [EMAIL PROTECTED]); g_option_context_add_main_entries(context, entries, NULL); g_option_context_set_ignore_unknown_options(context, FALSE); g_option_context_set_help_enabled (context, TRUE); if (!(g_option_context_parse(context, argc, argv, gerror))) { g_warning (Parse command line failed: %s, gerror-message); g_option_context_free(context); g_error_free(gerror); return (1); } if (gd_pch_title == NULL) { gd_pch_title = Title really needs to be here.; } if (gd_pch_body == NULL) { gd_pch_body = message goes here.; } if (gd_pch_icon == NULL) { gd_pch_icon = gtk-dialog-info; } if (gd_i_seconds 1 ) { gd_i_seconds = 10; } notify_init(argv[0]); nctx = notify_notification_new (gd_pch_title, gd_pch_body, gd_pch_icon, NULL); notify_notification_set_timeout (nctx, (gd_i_seconds * 1000) ); // 10 seconds if (!notify_notification_show (nctx, NULL)) { g_warning (failed to send notification); return 2; } g_object_unref(G_OBJECT(nctx)); notify_uninit(); return 0; } END CODE: On Thu, 2008-05-22 at 17:26 -0700, Tom Machinski wrote: Hi, I wrote a simple GTK+ application that displays a popup window. The problem is that whenever the window is displayed, it immediately gets (steals) the focus. I would like to prevent that from happening: i.e., the window should be created and displayed, but it should not be focused, but instead focus should be retained by whatever window had it before the creation of the new window. The only way I know to do that is by calling window.set_accept_focus(False) before window.show(). The serious flaw with that method is that the resulting window, while being prevented from stealing the focus, also can not receive focus at any later time, even by intentional user action. Any better approaches? Tom ___ 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: Column Values Changing in Treeview When Row Selected
Andrew, I reviewed the code you supplied. The gtk_tree_model_get() have the correct column numbers, so the fact that PART_COLUMN_CLASS is changing is interesting from a gcc compiler option perspective; but not cause for the problems you are experiencing. PART_COLUMN_CLASS should be a fixed enum value, and any changes to its value are likely to be caused by optimizing compiler options - not runtime issues. What are your compiler options; -Wall -g -ansi -O2, where -oh two(not zero two) is significant. I'm going to ignore that this number is changing - as its ability to change would cause chaos for all of gtk which makes extensive use of enums. Most likely cause of the behavior you describe!. The *iter value is not set to the currently selected row. I.E no selection mechanisum being used, or used incorrectly. CODE EXAMPLE: /* at the end of the treeview create routine */ ... GtkTreeSelection *part_select = NULL; part_select = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); gtk_tree_selection_set_mode (part_select, GTK_SELECTION_SINGLE); g_object_set_data (G_OBJECT (treeview), selection-pointer, (gpointer) part_select); ... /* * in the supplied routine -- validate the selection first, * then get/set data as originally shown */ GtkTreeSelection *part_select = NULL; GtkTreeIter iter;/* will get set to the selection */ part_select = (GtkTreeSelection *)g_object_get_data (G_OBJECT(treeview), selection-pointer); if (gtk_tree_selection_get_selected (prod_select, NULL, iter)) { gtk_tree_model_get (model, iter...); /* NOTICE SYNTAX OF iter -- */ /* -- set data */ } else { /* nothing selected */ } END CODE EXAMPLE: Maybe this is what was calling your original routine, I don't know. These are tips, research and adapt to your program as needed. The thinking is to set treeview for single selection, and when selected get the selected iter, then get the data. Getting the selected iter ensure you get the correct one each time. g_object_get_data/g_object_set_data() are example ways of storing values in the common object, so your routines don't need such a long parm list. James, On Sat, 2008-05-10 at 19:34 -0400, Andrew Rowland wrote: All, I'm not sure what I'm doing wrong. When I select a row in a treeview, the values of the columns are read and used to populate various entries and combos. The thing that I can't figure out is that the value of one column is being changed to the value of another column. Below is a snippet of the function (ANNOTATED IN CAPS) wherein the column value is changing. Running my app in gdb, I've been able to figure out where the change is occurring, but not why. I've looked at the API docs for GTK+ and studied the use of gtk_tree_model_get at codase.com. I don't see anything in my code that should cause this behavior. I've also tried to use gtk_tree_model_get_value and the same thing occurs. Any pointer, hints, outright solutions, or swift kicks in the keister would be greatly appreciated. TIA, Andrew Weibullguy Rowland --- CODE FOLLOWS --- gboolean populate_part_general_tab( GtkTreeModel *model, GtkTreeIter *iter ) { gchar *string = NULL; gfloat *floater; gint *integer; /* Populate the usage information. */ gtk_tree_model_get( model, iter, PART_COLUMN_PN, string, -1 ); gtk_entry_set_text( GTK_ENTRY(part_number), string ); gtk_tree_model_get( model, iter, PART_COLUMN_REFDES, string, -1 ); gtk_entry_set_text( GTK_ENTRY(ref_des), string ); gtk_tree_model_get( model, iter, PART_COLUMN_COMPREFDES, string, - 1 ); gtk_entry_set_text( GTK_ENTRY(comp_ref_des), string ); gtk_tree_model_get( model, iter, PART_COLUMN_DESC, string, - 1 ); gtk_entry_set_text( GTK_ENTRY(description), string ); gtk_tree_model_get( model, iter, PART_COLUMN_QUANT, integer, - 1 ); snprintf(string, 3, %d, integer); gtk_entry_set_text( GTK_ENTRY(quantity), string ); /* Set the part type combo box. */ gtk_tree_model_get( model, iter, PART_COLUMN_CLASS, integer, - 1 ); AT THIS POINT THE VALUE OF PART_COLUMN_CLASS IS 1, WHICH IS CORRECT gtk_combo_box_set_active( GTK_COMBO_BOX( part_type ), integer); AT THIS POINT THE VALUE OF PART_COLUMN_CLASS IS 0, WHICH IS INCORRECT /* Set the part subtype combo box. */ gtk_tree_model_get( model, iter, PART_COLUMN_COMP_SUBTYPE, integer, - 1 ); AT THIS POINT THE VALUE OF PART_COLUMN_CLASS IS 3, WHICH IS INCORRECT FOR PART_COLUMN_CLASS. BUT IS THE CORRECT VALUE OF PART_COLUMN_COMP_SUBTYPE. gtk_combo_box_set_active( GTK_COMBO_BOX( part_subclass ), integer ); ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Lost Pointer when adding GTK+ to an application
On Wed, 2008-05-07 at 21:02 -0600, Diego Rivera wrote: Thanks for the quick answer, however, the GTK+ component is the same process as the Console application. The console application checks for some arguments and finishes by calling the working function of the application with parameters that reflect the arguments received from the console. My GtkButton callback just calls this last function with some parameters i have selected. So no inter-process communication is requiered Thanks for the suggestion anyway OK, then you need to post some relevant portion of the code if possible. These type of issues can be as casued by simple things like - using local stack memory for structures vs malloc or g_new0() memory for them. Post your main() and the callback for us to look at. And please do consider the valgrind suggestion, or retry the gdb exercise. James, -Diego-- On Wed, May 7, 2008 at 8:55 PM, James Scott Jr [EMAIL PROTECTED] wrote: On Wed, 2008-05-07 at 20:33 -0600, Diego Rivera wrote: Hi! I am not exactly new to GTK+, however I have come across a problem i have no explanation for, and I'll be glad if someone could point me towards a possible solution. I am currently developing an application that uses various algorithms for sequence alignment in biological applications (DNA, RNA, Proteins and so on). This application is mainly for scientific purposes. The core algorithms are already running fine as a console application in a very stable version. I am working in adding some graphical interface to the program using GTK+. So, I built a little Window that asks for the different parameters and makes a call to the already defined functions in the console application, which are indeed stable. However, when making the call to the algorithm with GTK+ running, some of the pointers in my data structures get lost, and I just get a Segmentation Fault. While trying to debug this weird behavior, I have narrowed the problem to the fact of having a window running. Right now, I just have a main that creates a GtkWindow with a GtkButton, and the callback of the button calls the stable routine of the console application using some hard-wired parameters. I have made tests and the console application gives the correct answer for those parameters. However, when calling the routine from the callback, Segmentation Fault is the only result I have been able to get. I have tried with different versions of GTK+ and the outcome is persistent. The data structure of the console application looks something like this: typedef struct{ int length; char* seq; }sequence_t; typedef struct{ int n; int m; int** table; }table_t; typedef struct{ sequence_t* vp; sequence_t* wp; table_t* table; int scoring; int result; }alignment_t; Using gdb i have found that the Segmentation Fault occurs at some point when accesing the table from the alignment. I believe i have made no memory errors in my console application, since it runs ok every time. However, i haven't seen the correct output from my GTK application. Is there any hint that you could give me in order to correct the error? How did you add the GTK component to the existing console app; are they one process or two? Your segfault suggest that they are two separate processes. In which case attempting to share memory elements will cause a segfault every time no matter how correct and hard-coded the structures. You may need to consider designing in and using some type of IPC (Inter-Process Communications) like a named-pipe, shared-memory, socket communications, memory queue, etc. Something designed to communicate between two active processes. James, Thanks - Diego Rivera - ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Histogram and other statistical graphs
The GIW package maybe of interest to you. Its at giw.sourceforge.net. James, On Wed, 2008-04-23 at 12:29 +0200, Roberto Mantovani - AL wrote: Hi, I need to write a program that displays some statistical values so I would know if there are libraries fot GTK+ to draw histograms and other statistical rapresentations. Best regards, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk+ and eclipse problems
I have not explored the newest version of eclispe, which reports that it supports the autoconfig framework inside it Managed Make features; so there may be an easier way than this one. I always add a 'Makefile' in my source directory that includes the needed commands to build a gtk+ project. eclispe then has a properties tab that lets you choose the default build command i.e. make'. Here is an example Makefile that should work for your sample. James, BEGIN-MAKEFILE (indents are required to be TABS) ## Build the example programs FLAGS = -Wall -O2 CFLAGS = `pkg-config --cflags --libs gtk+-2.0 glib-2.0 gthread-2.0` -lm COFLAGS = `pkg-config --cflags gtk+-2.0 = 2.4.0 glib-2.0 = 2.4.0 gthread-2.0` -lm [EMAIL PROTECTED] $(FLAGS) $(CFLAGS) [EMAIL PROTECTED] $(FLAGS) $(COFLAGS) LINK_TARGET = your_program_name_here all: $(LINK_TARGET) @echo All Done %. : %.c @echo Compiling A $ $(CC) -o $@ -c $ @echo built $ %.o : %.c @echo Compiling B $ $(CO) -o $@ -c $ @echo built $ clean: rm -fv *.o *~ $(LINK_TARGET) END-MAKEFILE On Tue, 2008-03-25 at 15:24 +0300, Roman Makurin wrote: Hi All! It`s my first post to this list, so be patient :) I`ve got a problem with compiling gtk+ project in eclipse. Here is the simplest project from gtk tutorial: #include gtk/gtk.h int main( int argc, char *argv[] ) { GtkWidget *window; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_show (window); gtk_main (); return 0; } As you know, to get this working I need to pass additional options to gcc: `pkg-config --cflags --libs gtk+-2.0`. I think my problem is eclipse specific. I look through project settings but can`t find where to place above command. Is there any howto describing gtk+ development with eclipse ? Thanks PS: Sorry for my english ___ 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 do I spawn an unknown viewer for a known file?
Bastiaan, I looked into a solution for the similar problem last fall. I not sure if I will continue with this project so I HAVE NOT thoroughly tested it. This is what I came up with. James, From the numa.sourceforge.net package http://ext3carve.cvs.sourceforge.net/ext3carve/gfs_watch/client/numa_gui.c?view=markup [CODE] /* 1690 * Determines the type of file and attempts to launch it 1691 * using the default application or the shell 1692 */ 1693 static gboolean numa_gui_util_launch_restored (PNOTIFY pnotify, gchar *pch_file) 1694 { 1695 gboolean b_rc = TRUE; 1696 gchar *pch_uri = NULL, *pch = NULL; 1697 const char *pch_mime = NULL; 1698 const char *pemsg = NULL; 1699 GnomeVFSURI *vfs_uri = NULL; 1700 GnomeVFSMimeApplication *pApp = NULL; 1701 GList *glFile = NULL; 1702 GnomeVFSResult result; 1703 GError *gerror = NULL; 1704 1705 g_return_val_if_fail (pnotify != NULL, FALSE); 1706 g_return_val_if_fail (pch_file != NULL, FALSE); 1707 1708 numa_gui_util_log_msg (numa_gui_util_launch_restored, enter, pch_file); 1709 1710 1711 /* 1712* turn regular filename into a uri */ 1713 pch_uri = gnome_vfs_make_uri_from_input (pch_file); 1714 glFile = g_list_append (glFile, g_strdup ((gchar *)pch_uri)); 1715 1716 /* 1717* create a formal uri from output of above */ 1718 vfs_uri = gnome_vfs_uri_new (pch_uri); 1719 1720 /* 1721* get the mime type for this uri */ 1722 pch_mime = gnome_vfs_get_mime_type_from_uri (vfs_uri); 1723 1724 /* 1725* get the application to launch */ 1726 pApp = gnome_vfs_mime_get_default_application_for_uri (pch_uri, pch_mime); 1727 if (pApp == NULL) 1728 { 1729 if ( g_file_test (pch_file, G_FILE_TEST_IS_EXECUTABLE) ) 1730 { 1731 b_rc = g_spawn_command_line_async ( pch_file, gerror ); 1732 if ( gerror != NULL ) 1733 { 1734 g_snprintf(pnotify-cLastStatusMsg, sizeof(pnotify-cLastStatusMsg), 1735Launching { %s } EMsg=%s, pch_file, gerror-message); 1736 g_error_free (gerror); 1737 } else { 1738 g_snprintf(pnotify-cLastStatusMsg, sizeof(pnotify-cLastStatusMsg), 1739Launched { %s }., pch_file); 1740 } 1741 } else { 1742 g_snprintf(pnotify-cLastStatusMsg, sizeof(pnotify-cLastStatusMsg), 1743Unable to Launch { %s }., pch_file); 1744 b_rc = FALSE; 1745 } 1746 } 1747 else 1748 { 1749 /* 1750 * launch the application */ 1751 result = gnome_vfs_mime_application_launch (pApp, glFile); 1752 1753 switch (result) 1754 { 1755 case GNOME_VFS_OK: 1756 pch = the application was launched.; 1757 pemsg = gnome_vfs_result_to_string (result); 1758 b_rc = TRUE; 1759 break; 1760 case GNOME_VFS_ERROR_NOT_SUPPORTED: 1761 pch = the uri protocol is not supported by the application.; 1762 pemsg = gnome_vfs_result_to_string (result); 1763 b_rc = FALSE; 1764 break; 1765 case GNOME_VFS_ERROR_PARSE: 1766 pch = the application command can not be parsed.; 1767 pemsg = gnome_vfs_result_to_string (result); 1768 b_rc = FALSE; 1769 break; 1770 case GNOME_VFS_ERROR_LAUNCH: 1771 pch = the application command can not be launched.; 1772 pemsg = gnome_vfs_result_to_string (result); 1773 b_rc = FALSE; 1774 break; 1775 case GNOME_VFS_ERROR_INTERNAL: 1776 pch = internal error.; 1777 pemsg = gnome_vfs_result_to_string (result); 1778 b_rc = FALSE; 1779 break; 1780 default: 1781 pch = unknown launch error.; 1782 pemsg = gnome_vfs_result_to_string (result); 1783 b_rc = FALSE; 1784 } 1785 1786 g_snprintf (pnotify-cLastStatusMsg, sizeof(pnotify-cLastStatusMsg), 1787 Launch restored file using %s, %s, %s, pApp-name, pch, pemsg); 1788 } 1789 1790 /* 1791* release mem used */ 1792 gnome_vfs_mime_application_free (pApp); 1793 gnome_vfs_uri_unref (vfs_uri); 1794 g_free(pch_uri); 1795 g_list_free(glFile); 1796 1797 numa_gui_util_log_msg (numa_gui_util_launch_restored, exit, (b_rc) ? Launched : Failed); 1798 1799 return b_rc; 1800 } [/CODE] - Original Message From: Bastiaan Veelo [EMAIL PROTECTED] To: gtk-app-devel-list@gnome.org Sent: Saturday, March 8, 2008 5:11:02 PM Subject: How do I spawn an unknown viewer for a known file? Hi, What is the platform independent way to spawn a viewer for, say, a PDF document? Thanks, Bastiaan. ___ 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
Re: Text View Complaining about Double Free or Corruption
On Wed, 2008-02-27 at 21:03 -0500, Mark Rodriguez wrote: James, When doe s the error occur? 0. When program starts 1. When shutting down 2. When creating the text_view the first time 3. When creating the text_view the Nth time I will assume it happens durin shutdown (#1). Yes you are correct. In the real application, the application doesn't exit. It destroys the canvas and re-uses it with new controls. Rather than debug that [monster], I reduced the application to something more manageable that exhibit the same behavior. Yes, it should be handled like any other widget. The only special thing is its text_buffer! Consider gtk_text_view_new_with_buffer(), one is created automatically for when using the gtk_text_view_new() api. I don't think creating the GtkTextBuffer first would make any difference -- however, that where you are now. So try creating the GtkTextBuffer first, then use the ...with_buffer() api to create the view. This may produce a different result. Interesting. I tried a few different things today and was able to get the application to work as expected without crashing, but I don't like the solution as now it appears I'm leaking memory. Any thoughts on why if g_object_unref is called the application complains about the double free? I modified the code as follows (mainly the button_click_event handler was changed to handle the text buffer and to require clicking the 'Quit' button twice for exiting the app - this was just done for visibility reasons). ref's are strange things: When I run into this anomaly I do the following, reasoning that I must have only had a weak reference, and g_object_unref got confused -- anyway this normally works for me. /* creation code ... */ ... buffer = gtk_text_buffer_new(NULL); if (buffer != NULL) { g_object_ref (G_OBJECT(buffer)); gtk_object_sink (G_OBJECT(buffer)); } sinking it ensures that you have a full fledged reference that a later unref will honor. If your creating and deleting this text_view as needed, you will have to find the root cause of these messages. I notice that you prep'ed the main() to use threads. Your problem maybe related to how your using threads when creating/destroying the text view. I would suggest exploring this type of change. 1a. Only create/destroy in the main gtk/gdk thread. 1b. Fire off a g_timeout_add( 50, (GSourceFunc)fn_create_routine(), gpointer); where gboolean fn_create_routine(gpointer gp); calls the normal gtk_window_new() stuff to create a dialog or the window you plan to use the text_view in. All this gets you out of the normal gtk signal chain of events. signals iterate on themselves and I've seen unwinds cause random errors - like your double-free. 1c. Do essentially the same to destroy the window. 2a. I guess I don't actually delete/destroy main windows once created, I just hide them and present them again when needed. 2b. Or if I do destroy them, i keep the buffer and/or tree_model in a allocated memory structure. Thus gtk_text_view_new_with_buffer() is the type of call I most often use to create text_views. 3. You seem to be _show() ing objects before adding them to something. Look at vbox; you create it, show it, then add it to the main.window. The recommended style is to create, add, show. I don't think causes any immediate problems but it could be polluting something- anyway this strikes me as something worth cleaning up. James, [code] GtkWidget *main_window, *text_view, *box, *button; GtkTextBuffer* buffer; static void destroy_event(GtkWidget* widget, void* data) { gtk_main_quit(); } static void button_click_event(void) { if (text_view != NULL) { gtk_container_remove(GTK_CONTAINER(box), text_view); text_view = NULL; // leaking memory??? //g_object_unref(G_OBJECT(buffer)); buffer = NULL; } else { gtk_widget_destroy(main_window); main_window = NULL; } } int main(int argc, char* argv[]) { // initialize multi-threading within GLib g_thread_init(NULL); // initialize multi-threading within GDK gdk_threads_init(); // acquire thread lock gdk_threads_enter(); gtk_init(argc, argv); // create main window main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (main_window == NULL) abort(); g_signal_connect(G_OBJECT(main_window), destroy, G_CALLBACK(destroy_event), NULL); gtk_widget_show(main_window); box = gtk_vbox_new(FALSE, 5); if (box == NULL) abort(); gtk_widget_show(box); gtk_container_add(GTK_CONTAINER(main_window), box); buffer = gtk_text_buffer_new(NULL); if (buffer == NULL) abort(); text_view =
Re: Text View Complaining about Double Free or Corruption
g_object_ref_sink() replaces gtk_object_sink() Please make this substitution James, On Thu, 2008-02-28 at 00:04 -0500, James Scott Jr wrote: On Wed, 2008-02-27 at 21:03 -0500, Mark Rodriguez wrote: James, When doe s the error occur? 0. When program starts 1. When shutting down 2. When creating the text_view the first time 3. When creating the text_view the Nth time I will assume it happens durin shutdown (#1). Yes you are correct. In the real application, the application doesn't exit. It destroys the canvas and re-uses it with new controls. Rather than debug that [monster], I reduced the application to something more manageable that exhibit the same behavior. Yes, it should be handled like any other widget. The only special thing is its text_buffer! Consider gtk_text_view_new_with_buffer(), one is created automatically for when using the gtk_text_view_new() api. I don't think creating the GtkTextBuffer first would make any difference -- however, that where you are now. So try creating the GtkTextBuffer first, then use the ...with_buffer() api to create the view. This may produce a different result. Interesting. I tried a few different things today and was able to get the application to work as expected without crashing, but I don't like the solution as now it appears I'm leaking memory. Any thoughts on why if g_object_unref is called the application complains about the double free? I modified the code as follows (mainly the button_click_event handler was changed to handle the text buffer and to require clicking the 'Quit' button twice for exiting the app - this was just done for visibility reasons). ref's are strange things: When I run into this anomaly I do the following, reasoning that I must have only had a weak reference, and g_object_unref got confused -- anyway this normally works for me. /* creation code ... */ ... buffer = gtk_text_buffer_new(NULL); if (buffer != NULL) { g_object_ref (G_OBJECT(buffer)); gtk_object_sink (G_OBJECT(buffer)); } sinking it ensures that you have a full fledged reference that a later unref will honor. If your creating and deleting this text_view as needed, you will have to find the root cause of these messages. I notice that you prep'ed the main() to use threads. Your problem maybe related to how your using threads when creating/destroying the text view. I would suggest exploring this type of change. 1a. Only create/destroy in the main gtk/gdk thread. 1b. Fire off a g_timeout_add( 50, (GSourceFunc)fn_create_routine(), gpointer); where gboolean fn_create_routine(gpointer gp); calls the normal gtk_window_new() stuff to create a dialog or the window you plan to use the text_view in. All this gets you out of the normal gtk signal chain of events. signals iterate on themselves and I've seen unwinds cause random errors - like your double-free. 1c. Do essentially the same to destroy the window. 2a. I guess I don't actually delete/destroy main windows once created, I just hide them and present them again when needed. 2b. Or if I do destroy them, i keep the buffer and/or tree_model in a allocated memory structure. Thus gtk_text_view_new_with_buffer() is the type of call I most often use to create text_views. 3. You seem to be _show() ing objects before adding them to something. Look at vbox; you create it, show it, then add it to the main.window. The recommended style is to create, add, show. I don't think causes any immediate problems but it could be polluting something- anyway this strikes me as something worth cleaning up. James, [code] GtkWidget *main_window, *text_view, *box, *button; GtkTextBuffer* buffer; static void destroy_event(GtkWidget* widget, void* data) { gtk_main_quit(); } static void button_click_event(void) { if (text_view != NULL) { gtk_container_remove(GTK_CONTAINER(box), text_view); text_view = NULL; // leaking memory??? // g_object_unref(G_OBJECT(buffer)); buffer = NULL; } else { gtk_widget_destroy(main_window); main_window = NULL; } } int main(int argc, char* argv[]) { // initialize multi-threading within GLib g_thread_init(NULL); // initialize multi-threading within GDK gdk_threads_init(); // acquire thread lock gdk_threads_enter(); gtk_init(argc, argv); // create main window main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (main_window == NULL) abort(); g_signal_connect(G_OBJECT(main_window), destroy, G_CALLBACK(destroy_event), NULL); gtk_widget_show(main_window); box = gtk_vbox_new(FALSE, 5); if (box == NULL) abort
Re: Text View Complaining about Double Free or Corruption
On Tue, 2008-02-26 at 20:51 -0500, Mark Rodriguez wrote: James, I'm not sure what in your #include common.h, but I placed the following in mine #include stdlib.h /* for abort() */ #include gtk/gtk.h /* for gtk, gdk, and glib */ I have a few other things, but these are included and the app also build fine for me. I can even run it under Ubuntu and it behaves exactly as I'd expect. It was pointed ou With that single change the program compiled and executed without error message; as I would have expected. Thanks for taking to time to respond. I too can compile and run the application without any problems under Ubuntu; however, when I run the same application cross compiled under DirectFB/GTK, it complains about double free / corruption. It was pointed out the my destroy handler should actually be defined to return void, but this didn't seem to affect anything. The destroy handler is an GObject handler that is signaled almost as the last logical breath before the object is removed from active memory. I can see no problem using this shutdown method and I have used the same method in 10s of multi-threaded programs. This might be worth a try. g_signal_connect (G_OBJECT (main_window), destroy, G_CALLBACK (gtk_main_quit), NULL); i.e. take the fastest way out, reducing stack overhead. The crazy thing is that I only get this error when adding a text view. All other widgets (buttons, pop-ups, labels, sliders, etc.) seem to work just fine. Is there anything different about a text view and calling gtk_widget_destroy on it's parent? Should I destroy the text view explicitly instead of relying on the parent to clean things up? Perhaps I should handle things myself and follow some special or preferred order when destroying the text view within the window? No special or preferred method that I am aware of, and I use text_view all the time. Contextually, your problem must should be related to your Direct/FB setup, rather than GTK internals. However, I am not an expert just an experienced long time user. When doe s the error occur? 0. When program starts 1. When shutting down 2. When creating the text_view the first time 3. When creating the text_view the Nth time I will assume it happens durin shutdown (#1). I assume the text view can be handled just like any other widget, but there appears to be something special or different about it. Yes, it should be handled like any other widget. The only special thing is its text_buffer! Consider gtk_text_view_new_with_buffer(), one is created automatically for when using the gtk_text_view_new() api. I don't think creating the GtkTextBuffer first would make any difference -- however, that where you are now. So try creating the GtkTextBuffer first, then use the ...with_buffer() api to create the view. This may produce a different result. If all else fails, try using gdb to get a backtrace to see which modules/api generated that error message. Again, thanks. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Fw: C vs C++ for GTK
- Forwarded Message From: JAMES SCOTT [EMAIL PROTECTED] To: Michael L Torrie [EMAIL PROTECTED] Sent: Monday, November 26, 2007 2:37:18 PM Subject: Re: C vs C++ for GTK To list members following this subject: I have a question - not a flame, as I try to understand the diversity of responses to this topic. How many of you who have suggested Patrick learn something other than C, know C already for yourself. Over the course of my experience I have found that learning assembler and C for a given platform has helped me better understand and use that platform. Also, knowing C make picking up or reading other languages like - python, php, perl, and many others easier. I'm assuming that, those of you who are pointing another way - already know C! Why not let Patrick follow your well worn path through C/GLIB/GTK2, maybe he will come out afterwards to C++, Python, or some other door. Yes, my preference is C/GLib/Gtk+. But I use lots of other when needed. James, Just another Hobbyist and Professional Developer: 35+ years - Original Message From: Michael L Torrie [EMAIL PROTECTED] To: Patrick [EMAIL PROTECTED] Cc: gtk-app-devel-list@gnome.org Sent: Monday, November 26, 2007 1:11:07 PM Subject: Re: C vs C++ for GTK Patrick wrote: Hi Everyone. Sorry for the flame war bait, I know how passionate language debates get but I need some guidance. I am using PyGTK right now and I am happy with it, but a day is coming soon were the speed limitations and less-then-straight-forward threading will be an issue. I don't see any reason at all why a GUI done with PyGTK should be any slower than a GUI done with straight C. Thus I don't see any compelling reason to abandon Python for C or C++. That said, however, Python sometimes isn't the right language to use for computationally-intensive tasks. Personally I think you are going about this the wrong way. You could be wanting to do premature optimization. Rather than trying to replace python, you should consider either extending python with C or C++, to replace the slowest and most-used computational paths, and stick with python for everything else. It's very easy to write python modules in C (10 hours to learn), or C++ (Boost makes it easy to wrap C++ classes and functions). Alternatively you can code in C or C++ and embed Python to drive your GUI. I figure my next move should be to learn C or C++. I would like to stay up-to-date with things and I would like to be able to reuse GTK code from other Apps. When it comes to the basic API, translating a code-generated GUI between python and C++ (with GTKmm) should be very simple. Even translating it to C won't be that hard either, except that you don't have an easy way to bind callbacks to a particular instance of data without some work, like setting data values and using the void *data argument on the callbacks. I thought that C++ must be the way to go as it can do everything that C can plus plus but some heavy hitters don't seem enthused with it, Linus Torvalds in particular has been quoted as calling it a horrible language. From my experience it is those that don't understand C++ and how to wield it that describe it that way. Torvalds is biased anyway, since he's focused on kernel programming. I can only spend 8-12 hours a week programming, I am not a professional programmer, is C++ to complicated? Is C going out of date? Am I limited with C? C++ is complicated, but not overly so. I feel that coming from Python, C++ is probably going to be easier for you to move to than C. Again, though, I think Thanks-Patrick ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Michael Torrie Assistant CSR, System Administrator Chemistry and Biochemistry Department Brigham Young University Provo, UT 84602 +1.801.422.5771 ___ 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: C vs C++ for GTK
Michael, Thanks for the feedback, it seems we are on the same page on several counts. James, - Original Message From: Michael L Torrie [EMAIL PROTECTED] To: gtk-app-devel-list@gnome.org Sent: Monday, November 26, 2007 5:32:22 PM Subject: Re: C vs C++ for GTK JAMES SCOTT wrote: To list members following this subject: I have a question - not a flame, as I try to understand the diversity of responses to this topic. How many of you who have suggested Patrick learn something other than C, know C already for yourself. Over the course of my experience I have found that learning assembler and C for a given platform has helped me better understand and use that platform. Also, knowing C make picking up or reading other languages like - python, php, perl, and many others easier. I agree to a point. C isn't going to teach you much about list processing (a la LISP), domain-specific languages, lambda closures, proper variable binding, functional programming, etc. On the other hand, C helps one learn to manage resources explicitly (even garbage collection can bite you if you don't understand how resource management works), pointers, etc. The ideal computer science program would make sure one first knows (IE is taught) C, then some assembly, then Scheme, then Python. I'm assuming that, those of you who are pointing another way - already know C! Why not let Patrick follow your well worn path through C/GLIB/GTK2, maybe he will come out afterwards to C++, Python, or some other door. Too late for that! Patrick's already well into Python. Python is a great language to learn on, in my opinion. It's as instructive as learning LISP or Scheme, but as useful as C or C++, or even Java. I get the impression that Patrick already has some C proficiency. Yes, my preference is C/GLib/Gtk+. But I use lots of other when needed. I'm coming to the opinion that a good rule of thumb is just to always use python unless specific needs dictate otherwise. Writing GUI code in a low-level, compiled language just doesn't seem to be the wisest thing to do these days. That's not to say that you're advice to learn assembly and C isn't good. In fact it's important for all computer programmers to know, in my opinion. When I have to write in C, Glib is a godsend. And of course GTK+ for the GUI. Using Glib, I wrote a very complicated data parsing program using dynamic strings, hash tables, and tree structures all with Glib and only had one very small memory leak in 10,000 lines of code and building and destroying many trees. -- Michael Torrie Assistant CSR, System Administrator Chemistry and Biochemistry Department Brigham Young University Provo, UT 84602 +1.801.422.5771 ___ 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: Need 2D data display widget
Dan, The glinegraph package may be something you can use. Also, the GIW package might also work. Both are standalone gtk widgets, which can be used from a shared library or compiled into your code. Find them both here: http://mysite.verizon.net/skoona/id1.html James, - Original Message From: Dan H [EMAIL PROTECTED] To: gtk-app-list gtk-app-devel-list@gnome.org Sent: Friday, November 23, 2007 7:54:29 AM Subject: Need 2D data display widget Hello folks, I need a way to quickly display some 2D datasets in a graph. I don't need any editing functions or other interactivity, just two axes with some ticks and tick labels and a bunch of datapoints connected by lines. I've found the GtkPlot stuff from GtkExtra. The possibilities seem to be awesome and go way beyond my needs; however, I couldn't find any systematic API documentation. I've tried dissecting the example programs, but they are overfreighted with features and I'm completely stumped trying to do the most basic data display. Essentially everything just keeps segfaulting all over the place without useful diagnostics. I'm sure I could figure all this out if I had a week or two, but maybe there is a simpler solution. Thanks, --D. ___ 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: Can a button go in a treeview?
dhk, Yes it is possible. For an example take a look at the 'gtk-demo' example program. It 'gtk-demo' got installed on you machine along with the gtk-devel package; so you should already have it. James, - Original Message From: dhk [EMAIL PROTECTED] To: gtk-app-devel-list@gnome.org Sent: Monday, October 22, 2007 8:49:20 AM Subject: Can a button go in a treeview? Is there a way to put a button in a treeview or atleast put a label next to a toggle in a treeview? I want to be able to change the label on the button or toggle depending on the status of the row and then have it operate accordingly. Thanks, --dhk ___ 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: timeout function not called
Vicki, I though you might have been chopping something up, thats the reason for the quick samepl. I'm going to assume it worked for you and you understand why it works. As for GIOChannels, they are very handy and could be used in an elaborate scheme to get this simple thing done. James, (This mailing list has an archive you can search for q/a on GIOChannels and ProgressBars...) - Original Message From: [EMAIL PROTECTED] [EMAIL PROTECTED] To: James Scott Jr [EMAIL PROTECTED] Cc: gtk-app-devel-list@gnome.org Sent: Tuesday, October 9, 2007 11:45:52 AM Subject: Re: timeout function not called Thanks James, Sorry, I didn't mean to seem like I was ignoring you, but the code I am working on is part of a bigger application and I wasn't sure how to extract the bit I was working on into a usable piece. I was also looking into using GIOChannels to see if I could make that work. Thanks for the example. I'll work through it and see if I can get that working in my project. Sincerely, Vicki Quoting James Scott Jr [EMAIL PROTECTED]: Vicki, Here is a more complete example of how to resolve your issue. Compile with this command '# gcc -Wall -g -O2 `pkg-config --libs --cflags gtk+-2.0 glib-2.0 gthread-2.0` gprogress.c' -- Invent your own San Diego at sandiego.com! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: timeout function not called
Vicki, Here is a more complete example of how to resolve your issue. Compile with this command '# gcc -Wall -g -O2 `pkg-config --libs --cflags gtk+-2.0 glib-2.0 gthread-2.0` gprogress.c' BEGIN-CODE #include gtk/gtk.h /* no globals */ typedef struct _INSTANCE_VALUES { GtkWidget *progressbar; GThread *tid_growPart; gboolean b_pulse_control; gint i_growPart_rc; } STEMP, *PST; #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #define EXIT_SUCESS 0 #endif static gpointer fn_growPart (PST pInstance); static gboolean fn_progress_update (PST pInstance); static void cb_push_button_clicked (GtkButton *button, PST pInstance); int main (int argc, char *argv[]); int main (int argc, char *argv[]) { GtkWidget *window = NULL; GtkWidget *widget = NULL; GtkWidget *box = NULL; PSTpInstance = NULL; g_thread_init (NULL); gdk_threads_init (); gtk_init (argc, argv); pInstance = g_new0 (STEMP, 1); g_return_val_if_fail (pInstance != NULL, -1); /* create app window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, delete-event, gtk_main_quit, NULL); gtk_window_set_title (GTK_WINDOW (window), GrowPart Thread Example); box = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER(window), box); pInstance-progressbar = gtk_progress_bar_new (); gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pInstance-progressbar), Not Running!); gtk_box_pack_start (GTK_BOX(box), pInstance-progressbar, TRUE, TRUE, 0); widget = gtk_button_new_from_stock (GTK_STOCK_APPLY); g_signal_connect (G_OBJECT(widget), clicked, G_CALLBACK(cb_push_button_clicked), pInstance); gtk_box_pack_end (GTK_BOX(box), widget, TRUE, TRUE, 0); gtk_widget_show_all (GTK_WIDGET(window)); /* * enter the GTK main loop */ gdk_threads_enter (); gtk_main (); gdk_threads_leave (); g_free (pInstance); return 0; } static void cb_push_button_clicked (GtkButton *button, PST pInstance) { g_return_if_fail (pInstance != NULL); pInstance-b_pulse_control = TRUE; gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pInstance-progressbar), Please Wait!); g_timeout_add(100, (GSourceFunc)fn_progress_update, pInstance); pInstance-tid_growPart = g_thread_create ( (GThreadFunc)fn_growPart, pInstance, TRUE, NULL); } static gboolean fn_progress_update (PST pInstance) { g_return_val_if_fail (pInstance != NULL, FALSE); if (pInstance-b_pulse_control) { gtk_progress_bar_pulse (GTK_PROGRESS_BAR(pInstance-progressbar)); return TRUE; } else { pInstance-i_growPart_rc = GPOINTER_TO_INT( g_thread_join (pInstance-tid_growPart) ); gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pInstance-progressbar), Not Running!); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(pInstance-progressbar),0.0); return FALSE; } } /* * gthread routine * -- never do any gtk calls from this thread - NEVER */ static gpointer fn_growPart (PST pInstance) { gint i_index = 0; if (pInstance == NULL) { g_thread_exit( GINT_TO_POINTER(EXIT_FAILURE) ); } /* do work */ /* growPart(); */ while (i_index++ 40) { g_usleep (25); /* 1/4 second * 40 = 10 seconds */ } pInstance-b_pulse_control = FALSE; g_thread_exit( GINT_TO_POINTER( EXIT_SUCESS ) ); return NULL; } END-CODE James, On Thu, 2007-10-04 at 13:27 -0700, [EMAIL PROTECTED] wrote: Thanks James for giving me my first experience with Thread programming! I tried the code you sent me, but unfortunately, I still can't get the progress_update function to run, looks like it never gets called. Any idea why this might be happening? growPart still runs. Thanks, Vicki [Hide Quoted Text] GTK program before. The ret=wait(null) causes execution to stop at that point and wait for growPart() to finish. A way to get around the logistics of fork() is to use threads directly. Consider the following; /* globals */ gboolean b_pulse_control = FALSE GThread *grow_thread_id = NULL; gint global_ret = 0; b_pulse_control = TRUE; timer = g_timeout_add(50, (GSourceFunc) progress_update, (gpointer)progressbar); grow_thread_id = g_thread_create ( growPart_thread, b_pulse_control, TRUE, NULL); static gboolean progress_update (gpointer progressbar) { if (b_pulse_control) { gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar)); return true; } else { global_ret = GPOINTER_TO_INT( g_thread_join (grow_thread) ); return FALSE; } } static gpointer growPart_thread(gpointer b_pulse) { /* do work */ growPart(); *b_pulse = FALSE; g_thread_exit( GINT_TO_POINTER( 1 ) ); } I would do the passing of control values via a structure to avoid the use of globals, but this
Re: timeout function not called
On Thu, 2007-10-04 at 13:27 -0700, [EMAIL PROTECTED] wrote: Thanks James for giving me my first experience with Thread programming! I tried the code you sent me, but unfortunately, I still can't get the progress_update function to run, looks like it never gets called. Any idea why this might be happening? growPart still runs. Thanks, Vicki The code i offered is really high level - almost sudo code. I prefer to evaluate a fuller example, if you care to post the whole program - or email it to me and I will email it back. Things I would be interested in would be as follows; 1. did you do away with the fork() and wait() calls? 2. did you compile it with something like this - with gthread included? # gcc -Wall `pkg-config --libs --cflags gtk+-2.0 glib-2.0 gthread-2.0` program.c 3. Did you call g_thread_init() in main(). ? /* * Initialize GLib thread support and GTK */ g_type_init (); g_thread_init (NULL); gdk_threads_init (); gtk_init (argc, argv); /* create app window */ /* create progress bar dialog */ /* * enter the GTK main loop */ gdk_threads_enter (); gtk_main (); gdk_flush (); gdk_threads_leave (); return (0); 4. How long does growPart() run? longer than 100ms the g_timeout_add() is only for 50ms, and it waits 50ms before making the first call kinda short, try 250 or 400 5. Assuming your created a dialog box for the progress bar and thats is is visible it should have ran. Stick a g_debug(update); in the progress_update() routine after the call to gtk_progress_bar_pulse() 6. I'm thinking the most likely cause is how the program was compiled. send me some code to look at! James, [Hide Quoted Text] GTK program before. The ret=wait(null) causes execution to stop at that point and wait for growPart() to finish. A way to get around the logistics of fork() is to use threads directly. Consider the following; /* globals */ gboolean b_pulse_control = FALSE GThread *grow_thread_id = NULL; gint global_ret = 0; b_pulse_control = TRUE; timer = g_timeout_add(50, (GSourceFunc) progress_update, (gpointer)progressbar); grow_thread_id = g_thread_create ( growPart_thread, b_pulse_control, TRUE, NULL); static gboolean progress_update (gpointer progressbar) { if (b_pulse_control) { gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar)); return true; } else { global_ret = GPOINTER_TO_INT( g_thread_join (grow_thread) ); return FALSE; } } static gpointer growPart_thread(gpointer b_pulse) { /* do work */ growPart(); *b_pulse = FALSE; g_thread_exit( GINT_TO_POINTER( 1 ) ); } I would do the passing of control values via a structure to avoid the use of globals, but this should work for you. -- Invent your own San Diego at sandiego.com! ___ 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: timeout function not called
On Tue, 2007-10-02 at 10:51 -0400, [EMAIL PROTECTED] wrote: I'm still muddling my way through my first GTK application (and I'm a relative newbie on all software matters). I have the following in one of my callbacks: timer = g_timout_add(50, (GSourceFunc) progress_update, (gpointer)progressbar); pid = fork( ); if (pid == 0) { growPart ( ); exit(0); } ret = wait(NULL); g_source_remove(timer); --- where progress_update is: static gboolean progress_update (gpointer progressbar) { gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar)); return true; } I was hoping that this would mean that the progress bar would pulse while growPart() was running, but instead it waits until after (is this because control hasn't been returned to gtk_main yet?) at which point it is removed. If I take out the g_source_remove it runs beautifullybut only after growPart has completed. How can I get around this? Thanks so much The use of FORK is a little odd, I don't think I've seen that used in a GTK program before. The ret=wait(null) causes execution to stop at that point and wait for growPart() to finish. A way to get around the logistics of fork() is to use threads directly. Consider the following; /* globals */ gboolean b_pulse_control = FALSE GThread *grow_thread_id = NULL; gint global_ret = 0; b_pulse_control = TRUE; timer = g_timeout_add(50, (GSourceFunc) progress_update, (gpointer)progressbar); grow_thread_id = g_thread_create ( growPart_thread, b_pulse_control, TRUE, NULL); static gboolean progress_update (gpointer progressbar) { if (b_pulse_control) { gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar)); return true; } else { global_ret = GPOINTER_TO_INT( g_thread_join (grow_thread) ); return FALSE; } } static gpointer growPart_thread(gpointer b_pulse) { /* do work */ growPart(); *b_pulse = FALSE; g_thread_exit( GINT_TO_POINTER( 1 ) ); } I would do the passing of control values via a structure to avoid the use of globals, but this should work for you. James, This is an e-mail from General Dynamics Land Systems. It is for the intended recipient only and may contain confidential and privileged information. No one else may read, print, store, copy, forward or act in reliance on it or its attachments. If you are not the intended recipient, please return this message to the sender and delete the message and any attachments from your computer. Your cooperation is appreciated. ___ 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: GtkNotebookPage
On Sun, 2007-09-30 at 10:07 -0400, dhk wrote: I have a notebook with a treeview on each page. I'm trying to reference a treeview on a notebook tab when it is clicked and compare it to another treeview on another tab; I'm using the switch-page signal. The treeviews are in vbox's in the tabs and I can't seem to get to the one on the tab that was clicked. The callback is like this . . . void on_ipm_notebook1_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guintpage_num, gpointer user_data) { GtkWidget *tv=(GtkWidget *)user_data; /* the treeview is in c_page */ GtkWidget *c_page=gtk_notebook_get_nth_page(notebook, page_num); } When creating the notebook page and treeview. set the treeview's pointer into the vbox as userdata, then during the callback routine get that userdata or pointer. now you have the pointer to the treeview, preform normal treeview operation. During Create: g_object_set_data (G_OBJECT(vbox), TreeView-ptr, (gpointer)ptreeview); During Callback: treeview = (GtkTreeView *)g_object_get_data (G_OBJECT(page), TreeView-ptr); Note: from the callback param list, '*page' is the value you supplied to 'gtk_notebook_append_page(p1, p2,p3)' as p2. This would normally be your vbox. James, How would I get the treeview that's on the c_page? Is there a way to send more than one object in with user_data? user_data doesn't seem to like pointer-to-pointer (GtkWidget **tv) data. Also, what can you do with the GtkNotebookPage object? I don't see why this is passed in since there doesn't seem to be a way to use it. Thanks in advance, --dhk ___ 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: Row number in TreeView
LUK, This link answers your original double-click question! Read the Tutorial! http://scentric.net/tutorial/sec-selections-double-click.html James , On Mon, 2007-09-17 at 09:29 +0100, Lukasz Gromotowicz wrote: Thanks for the response. I still have a problem. Maybe because I use GTKmm. I have signal_row_activated connected to the function: void TMainWindow::on_TreeView1_dblclick( const Gtk::TreeModel::Path path, Gtk::TreeViewColumn* tvcolumn) I have taken it from GTKmm documentation. in this function I put what you suggested: gint* i = gtk_tree_path_get_indices (path); Compilation returns an error: cannot convert 'const Gtk::TreePath' to 'GtkTreePath*' for argument '1' to 'gint* gtk_tree_path_get_indices(GtkTreePath*)' What should I change? Where to find the clear explanation of the TreeView widget (gtk.org and gtkmm.org are the best places?) Does GTKmm defines EVERYTHING from the GTK+ or sometimes I will have to use functions from the GTK+? Best regards, LUK 2007/9/16, Claudio Saavedra [EMAIL PROTECTED]: El dom, 16-09-2007 a las 00:32 +0100, Lukasz Gromotowicz escribió: Hi all, I know it is probably something simple, but I am new to the gtk. I have a TreeView and associated ListStore. I am trying to get the row number after I double-click on it. I have a path which I think I should use, but I do not know how. With gtk_tree_path_get_indices (). Claudio -- Claudio Saavedra [EMAIL PROTECTED] Día del Software Libre, Curicó http://curico.diadelsoftwarelibre.cl ___ 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: gtk pango draw rotated text
Take a look at the excellent example in the program 'gtk-demo', which should be installed on your system already. Try '# gtk-demo', then choose the 'rotated text' example. Note: double-clinking the choice launches the example, also notice the two tabs - one show description, one show the actual code. James, On Mon, 2007-09-10 at 00:33 +0100, Luis Rodrigues wrote: Hi, I want to draw some rotated text on a Window. I've tried every code I found on the net but still no solution :( I would like to draw some rotated text on a window, the rotation point should X,Y and not to the center of the rectangle where the text is draw. Can anyone please help me? This is my current code (in pascal): WidgetCont := pango_layout_get_context(UseFont); rotated_matrix.xx := 1.0; rotated_matrix.xy := 0.0; rotated_matrix.yx := 0.0; rotated_matrix.yy := 1.0; rotated_matrix.x0 := 0.0; rotated_matrix.y0 := 0.0; pango_matrix_rotate (@rotated_matrix, 45); pango_context_set_matrix (WidgetCont, @rotated_matrix); pango_layout_context_changed (UseFont); gdk_draw_layout_with_colors(DevCtx.drawable, DevCtx.GC, X, Y, UseFont, Foreground, nil); Thanks in advance. Luis ___ 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: gtk_widget_show() not showing window
Paul, I am not sure if you got an answer, so here is my expectation - am I am no expert. GTK _show/_hide api have an impact on the expose or painting function of gtk widgets. This effect is a consolidation of area needing repaint as a result of many factors. Thus a _show_all. _hide, and _show should be netted to the effect of a single gtk_widget_show(); unless there is an opportunity to process the gtk_main() loop in between calls; and I didn't see that. Is this your experience? James, On Tue, 2007-08-28 at 06:58 +, G. Paul Ziemba wrote: On Mon, 2007-08-27 at 19:00 +, G. Paul Ziemba wrote: gtk_widget_show_all(window); gtk_widget_hide(window); gtk_widget_show(window); gtk_main(); [EMAIL PROTECTED] (James Scott Jr) writes: Try this instead. The gtk_widget_show_all() then gtk_widget_hide() then gtk_widget_show() is the cause of your problem; unless you were thinking the window should blink once before appearing. gtk_widget_show_all(window); gtk_main(); Thank you for your suggestion - I must apologize because I should have mentioned (but forgot) in my original post that I am actually trying/helping to debug a problem in a larger piece of software (http://bugzilla.gnome.org/show_bug.cgi?id=467776). This test program is a minimal set of code that demonstrates the problem. My real question is, should the show_all/hide/show sequence work? thanks, ~!paul ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_widget_show() not showing window
Try this instead. The gtk_widget_show_all() then gtk_widget_hide() then gtk_widget_show() is the cause of your problem; unless you were thinking the window should blink once before appearing. James, #include gtk/gtk.h static void button_clicked_cb(GtkButton *button, gpointer data) { GtkWidget *window2; window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_show_all(window2); } int main(int argc, char **argv) { GtkWidget *window; GtkWidget *button; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), delete_event, G_CALLBACK(gtk_main_quit), NULL); button = gtk_button_new_with_label(Click me); g_signal_connect(G_OBJECT(button), clicked, G_CALLBACK(button_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(window), button); gtk_widget_show_all(window); gtk_main(); return 0; } On Mon, 2007-08-27 at 19:00 +, G. Paul Ziemba wrote: Greetings, gtk_widget_show() does not seem to be operating the way I expect; could one of the experts please tell me if something is wrong with this code or if something is wrong with gtk? When I run this small bit of code, the window appears briefly and then disappears immediately. The program does not exit. I expect the window to stay visible (due to gtk_widget_show()), but it's not happening. many thanks! Versions: OS: FreeBSD 6.2-STABLE #0: Sun Jun 3 19:55:09 PDT 2007 gtk: gtk-2.10.12, gtk-2.10.14 Test program compiled with: gcc -o test test.c `pkg-config --cflags --libs gtk+-2.0` Test Program: #include gtk/gtk.h static void button_clicked_cb(GtkButton *button, gpointer data) { GtkWidget *window2; window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_show_all(window2); gtk_widget_hide(window2); gtk_widget_show(window2); } int main(int argc, char **argv) { GtkWidget *window; GtkWidget *button; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), delete_event, G_CALLBACK(gtk_main_quit), NULL); button = gtk_button_new_with_label(Click me); g_signal_connect(G_OBJECT(button), clicked, G_CALLBACK(button_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(window), button); gtk_widget_show_all(window); gtk_widget_hide(window); gtk_widget_show(window); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK plot graph
Dieterle, If you would like an even simpler example/tool - pick up glinegraph from this link http://sourceforge.net/project/showfiles.php?group_id=157888 It does exactly what I needed and may work for you. James, On Fri, 2007-06-29 at 12:06 +0200, Daniel Dieterle wrote: Hey, after googling: draw curves in gtk i found the gtk+extra packages. I think GtkPlot is what i need. Sorry for disturbing you. Perhaps this contribution helps the next guy to find the right tool. Daniel. On Fri, 2007-06-29 at 11:45 +0200, Daniel Dieterle wrote: Hi, my goal is to plot a simple array of floating-values in a gtk plot. I want some basic operations on the graph, like zooming in/out, fast redrawing of the graph , ... - gtk-curve seems not to be poweful enough. Also: This widget is considered too specialized/little-used for GTK+, and will in the future be moved to some other package. from the gtk-API. So it seems not to good. - there seems a way to user gnu-plot, which is interesting, but i doesn't want of performance reasons. Isn't there a easy and powerful way to plot graphs in GTK? Thanks, Daniel. PS: - Platform: Linux - Language: c ___ 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: treeview: seg fault When Collapsing a Row Containg a Selected Item
On Sun, 2007-06-17 at 09:37 -0400, Marshall Lake wrote: I have a treeview/treestore containing many top-level rows. Each top-level row contains many children. The treeview works fine except for one thing. If the user expands a top-level row, selects a child, and then collapses that row the program seg faults with the console error: gtk_tree_store_get_value: assertion `iter-stamp == GTK_TREE_STORE (tree_model)-stamp' failed gtype.c:3351: type id `0' is invalid can't peek value table for type `invalid' which is not currently referenced Without seeing the code I can only guess. I seems that the iter your using is invalid -- or no longer valid. This could occur if you used a LOCAL variable to create the iter; then saved the pointer of that inter and tried to use it somewhere else which creates the segfault. To poke around looking for it, use this api to test iters before use: bool=gtk_tree_store_iter_is_valid(GtkTreeStore *tree_model, GtkTreeIter *iter) I apologize for not posting the code originally. See below. I don't quite understand how the gtk_tree_store_iter_is_valid() function will help me since the seg fault occurs when the top-level row is collapsed and is (seemingly ?) out of my control. void TeamSelected2 (GtkTreeSelection *selection) { GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; gint sub, row_count, x; gchar *teamname, path_str[10] = ; gboolean valid; gtk_tree_selection_get_selected (selection, model, iter); The gtk_tree_selection_get_selected() api returns TRUE is something is selected. You never checked its return value! consider doing this: if (selection == NULL) { return; } if ( !( gtk_tree_selection_get_selected (selection, model, iter) ) ) { return; } gtk_tree_model_get (model, iter, NAME_COLUMN, teamname, -1); if (strlen (teamname) == 4) /* user clicked on a year */ return; Not sure what your looking for here? you already have the iter to the selected row? for (sub = row_count = 0; sub toplevelentries; sub++, row_count = 0) { /* walk through the root level of data (years) */ sprintf (path_str[0], %d:0, sub); path = gtk_tree_path_new_from_string (path_str[0]); valid = gtk_tree_model_get_iter (model, iter, path); while (valid) { /* walk through the sub-level (teams), looking for the selected row */ if (gtk_tree_selection_iter_is_selected (selection, iter) == TRUE) /* get out of the for() loop */ goto GetOutFor; row_count++; valid = gtk_tree_model_iter_next (model, iter); } } GetOutFor: [do some processing and return] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: treeview: seg fault When Collapsing a Row Containg a Selected Item
On Sat, 2007-06-16 at 12:15 -0400, Marshall Lake wrote: I have a treeview/treestore containing many top-level rows. Each top-level row contains many children. The treeview works fine except for one thing. If the user expands a top-level row, selects a child, and then collapses that row the program seg faults with the console error: gtk_tree_store_get_value: assertion `iter-stamp == GTK_TREE_STORE (tree_model)-stamp' failed gtype.c:3351: type id `0' is invalid can't peek value table for type `invalid' which is not currently referenced Without seeing the code I can only guess. I seems that the iter your using is invalid -- or no longer valid. This could occur if you used a LOCAL variable to create the iter; then saved the pointer of that inter and tried to use it somewhere else which creates the segfault. To poke around looking for it, use this api to test iters before use: bool=gtk_tree_store_iter_is_valid(GtkTreeStore *tree_model, GtkTreeIter *iter) never trust an iter... James, The treeview works fine if the user never collapses the row and goes on to make another selection, either in that same top-level or a different top-level. Also, if a row is expanded and then collapsed with no child being selected it works fine. As an aside (?), I tried gtk_tree_selection_unselect_iter() on the child after it was selected and got a seg fault and the same error as noted above at the point the gtk_tree_selection_unselect_iter() was executed. Can someone tell me what might need to be done to avoid the seg fault? ___ 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 build a GtkTree?
Guenther Michelle, Here is the tutorial for TreeViews, which explains how to create, add/remove, and destroy a treeview. Not to mention the gtk-demo program contains examples and source. http://scentric.net/tutorial/treeview-tutorial.html James, - Original Message From: Michelle Konzack [EMAIL PROTECTED] To: gtk-app-devel-list@gnome.org Sent: Wednesday, June 13, 2007 12:59:08 PM Subject: Re: How to build a GtkTree? Hello Guenther, I have read the thread and I have the same proble, since YOUR structure is exactly the same as the Maildir format :-) I have problems getting the parent itter... ...and then, if a tree is there and in the server sice appear a new directory HOW to add this to the existing tree? GTK is nice but it is using my last nervs! Thanks, Greetings and nice Day Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant Am 2007-05-26 13:08:06, schrieb Guenther Meyer: What I like to do, is building a tree from some data, that is available in the following format: catA CatB CatB.a CatB.b CatB.a.x CatC CatC.q CatC.q.1 CatC.q.1.a CatD ... and so on... - END OF REPLIED MESSAGE - -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSN LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gdk_widget_modify_bg deadlock
Bethany, Consider moving the gdk_threads_* outside the for-loop, look for A B changes. Also, I use these API's as ONE BIG wrapper around all gtk/gdk work from background threads. I have found doing anything from a secondary thread with GDK/GTK to be problematic. The best guidance might be find a way to use g_idle_add() or g_timeout() along with GASyncQueue to poll background threads for ready-gui actions and have the g_timeout(gtk-thread-function()) do the work. A gtk-thread-function() runs in the same thread/task address space as GTK, so gdk_threads_leave() are not likely to cause a deadlock. James, - Original Message From: Bethany Seeger [EMAIL PROTECTED] To: gtk-app-devel-list@gnome.org Sent: Wednesday, June 6, 2007 2:31:44 PM Subject: gdk_widget_modify_bg deadlock Hello, I've got this code that seems to end up in dead lock, if I do something to the gui, while it's calling gtk_widget_modify_bg. - { // events is an array of widget names static GtkWidget *labels[NCONDS] = { NULL }; static unsigned int last=0x; int i; GdkColor yellow = {0,0x,0x,0}; if (!labels[0]) { /* Find our labels, the first time. */ for (i = 0; i NCONDS; i++) { labels[i] = lookup_widget(toplevel,events[i]); } } /* Set the condition register widgets. */ if (cond != last) { gdk_threads_enter(); /* A */ for (i = 0; i NCONDS; i++) { /* ** gdk_threads_enter(); ** A */ if (cond (1i)) { gtk_widget_modify_bg(labels[i],GTK_STATE_NORMAL,yellow); } else { gtk_widget_modify_bg(labels[i],GTK_STATE_NORMAL,NULL); } /* ** gdk_threads_leave(); ** B */ } gdk_threads_leave(); /* B */ last = cond; } } -- The threading has been properly initialized : g_thread_init(NULL); gdk_threads_init(); gtk_set_locale(); gtk_init(argc,argv); ... gdk_threads_enter(); gtk_main(); gdk_threads_leave(); The thread that's running the gtk_widget_modify_bg code was created from the main thread before it went into the gtk_main(). So I understand that I've got a main thread in gtk_main, and another thread running behind the scenes and updating the gui with user changes. If I try to change something in the gui (going to a new tab in a notebook widget) while it's running the gtk_widget_modify_bg, the gui will hang, like I've hit a deadlock condition. It happens to be the page with the widget on it that the gtk_widget_modify_bg is on. Would that be enough cause this condition? Any work arounds? The kicker is that this works fine in linux (no deadlock) -- it only deadlocks on a cross compiled windows exe. Any advice would be greatly appreciated. I don't know the ins and outs of gdk/gtk threading and can't tell if I'm doing something that's just plain wrong. Thanks, Bethany ___ 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: Plotting graphs
On Thu, 2007-05-24 at 06:27 -0700, Bluezapper wrote: Hi, Can someone refer me to an example which plots a simple 2D graph using gtkextra API. thanks, bluezapper. I have used successfully both GtkExtra and GtkDataBox libraries. However, for the app I was writing I found them too big for the simple graph I needed; so I created my own. Here is the link: GLINEGRAPH http://mysite.verizon.net/skoona/id1.html As a result of creating my own I have also contributed to a embedded project which also contains a GTK based 2D scientific graph; here is its link: http://giw.sourceforge.net/ James, - Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. 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: Treeview doesnt refresh upon reopenning window
- Original Message From: Jason Brisbane [EMAIL PROTECTED] To: Glade-Users [EMAIL PROTECTED]; Glade App-Devel-List gtk-app-devel-list@gnome.org Sent: Monday, April 23, 2007 10:14:50 AM Subject: Treeview doesnt refresh upon reopenning window Hello All, I am looking for a fix for a Treeview issue that I am having. I have created a Treeview that gets its data from a database and populates the list with the results of the database. This works well as even if the database table was empty (rows=0) then it still displays the headers (better than I thought). In my example, I have a treeview on one half of the screen and the database fields showing the data on the right (table). This shows the data just wonderfully. If I add a record, or conversely if I select a record and delete it, the treeview doesnt get updated. I am calling the _show function after each time, but I dont believe that the gtk_destroy_treeview is actually doing its job. Surely it would kill the treeview, model, store, and everything with it when you kill it? Here is the _show code. Of course this works fine on starting the window the first time but doesnt refresh. I get the following message when the window tries to update: (battlemaster:11819): Gtk-CRITICAL **: gtk_scrolled_window_add: assertion `bin-child == NULL' failed PS: Do I need to g_free/g_object_unref the list_store or other objects before returning? Thanks in advance. void on_monstertype_show(GtkWidget *widget, gpointer user_data) { gchar *sql; MYSQL *conx; MYSQL_RES *result_set; MYSQL_ROW db_row; MYSQL_FIELD *field; GtkListStore *list_store; GtkTreeModel *model; GtkTreeIter iter; GtkWidget *view; GtkCellRenderer *renderer; GtkTreeSelection *selection; gtk_widget_destroy(lookup_widget(widget, treeview4)); /* First, connect to the database. */ conx = mysql_init(0L); if (conx != 0L) { conx = mysql_real_connect(conx, LOCALHOST, USER, PASS, DBASE,0,0L,0); if (conx != 0L) { sql = g_strconcat(select monsterid, creaturetype from monstertype ; , 0L); if (mysql_query (conx, sql) == 0) { result_set = mysql_store_result (conx); // CREATE THE TREE_VIEW and hook the row selection event into it! view = gtk_tree_view_new(); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_select_function(selection, mt_selection_func, NULL, NULL); // CREATE COLUMN HEADERS // -- Column 1 -- renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, ID, renderer, text, COLUMN_ONE, NULL); // -- Column 2 -- renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, Type, renderer, text, COLUMN_TWO, NULL); // Now Fill with the Data list_store = gtk_list_store_new (2,G_TYPE_STRING, G_TYPE_STRING); // ADD ONE ROW FOR EACH MYSQL ROW RETRIEVED while ((db_row = mysql_fetch_row (result_set)) != 0L) { // Display the Columns in the gtkListstore gtk_list_store_append (list_store, iter); gtk_list_store_set (list_store, iter, COLUMN_ID, db_row[0], COLUMN_LOCATION, db_row[1], -1 ); } model = GTK_TREE_MODEL(list_store); gtk_tree_view_set_model (GTK_TREE_VIEW(view), model); g_object_unref (model); gtk_container_add (GTK_CONTAINER(lookup_widget(widget, scrolledwindow4)), view); gtk_widget_show_all(widget); mysql_close(conx); } } } } Jason, You need to reconsider how your using the TreeView. Your are creating and loading everything every time; and not checking to see that lookup_widget() in calls like gtk_widget_destroy(lookup_widget(widget, treeview4));, actually returned a vaild value -- this is the cause of your error messages. Let me suggest an alternate sequence based on your scenario. Start of Program: 1. Create ListStore 2. Create TreeView using liststore 3. Open DataBase, insert/append records to list store. 4. some data change occurs (you may have to periodically count db.rows or something) 5. read from Database 6. Check to see if record exist in liststore (if yes, skip; else append) 7. goto step 4; unless exit signal 8. If exit signal, be nice and destroy TreeView TreeView's can last forever and will automatically update when their datastore is updated. The trick is to keep the liststore updated without purging it and reloading everything. There are several programming methods that would allow you to update the liststore when you update the database - these are of course defeated when some other program updates the database. I have not looked to see if SQL has a way of informing a program that certain data tables have been modified - i just don't know. It would be worth considering or searching for! James, -- Regards, Jason Brisbane ___
Re: Treeview doesnt refresh upon reopenning window
- Original Message From: Jason Brisbane [EMAIL PROTECTED] To: JAMES SCOTT [EMAIL PROTECTED] Sent: Monday, April 23, 2007 11:12:49 AM Subject: Re: Treeview doesnt refresh upon reopenning window HI, Just a few issues I have been having with that: - gtk_widget_destroy doesnt have a return value and another lookup_widget to check if it exists would generate an error. Comment: lookup_widget() returns a value or null. its this value that's sometimes null and causing the error. consider: ... GtkWidget *widget = NULL; ... widget = lookup_widget(widget, treeview4); if () { gtk_widget_destroy(widget); } ... - Every version of a treeview (from the internet, the GTK devhelp, etc) I have found says that the liststore cannot be accessed after it is used to create the model/view. If anyone can let me know how to access a liststore after the listview is populated with data (ie how to access the colums/rows and data therein) I'd change my approach. Comment: These are advanced examples but look at the code in http://GapcMon.Sourceforge.net/ and http://gfhcm.sourceforge.net/ In them one or more treeviews are created and continually updated. Here are documentation links which may shed more light: GTK+2.0 Tutorial http://scentric.net/tutorial/ - the liststore is created when the window is shown and the window's other process can all access the treeview access points and get the data therein. The liststore however, I cannot access for love nor money. Comment: This will return ptr to the associated liststore. GtkTreeModel *gtk_tree_view_get_model(GtkTreeView *tree_view);Then with the gtk_tree_store_{set,remore,insert, insert_before,insert_after,prepend,append} api you can do everything except 'get' a record; use gtk_tree_model_get() to do that. - I'll always know when the database changes - every time I want to issue the _show command. I could create another function called repopulate_treeview but since the _show is going to do the exact same thing, at the exact same time, it seemed pointless. Comment: That would work; Just don't destroy and recreate it everytime. Keep a ptr to the treeview and use that ptr to rediscovery the liststore for update operations. If you change the liststore the treeview will automatically refresh. -Also, since the database will be sorted on its fields, I dont want to have to make the program do any sorting. Thus all I need to do is grab the result_set and repopulate the liststore from the top down with each row, which will be presorted. Plus the list will only have approx 30 rows in it. Comment: You can enable the treeview headers to be selectable -- causing a dynamic column sort; plus a treeview can apply a default sort which you control. If anyone can point me in the direction of how to re-write the program to show the treeview's data then I'd be a very happy man! Comment: Look at my apps and others; read the tutorial, and I hope your using DevHelp and documentation app installed by default on most distributions; fedora yum install devhelp. The only issue you may run into is Glade related; I don't know glade well, so someone else will need to help you if you have glade issues. Thanks in advance. SNIP -- Regards, Jason Brisbane ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: g_io_add_watch, g_io_channel_read stops working after sometime.
On Wed, 2007-04-18 at 04:39 -0700, Rehan wrote: Hi, I am trying to write a program based on client-server architecture. I need only one client connection hence i am first listening to client then accept() is called. after accept() i call g_io_channel_unix_new () and then g_io_add_watch() and later in the function i use g_io_channel_read to read data from the channel. Everything works fine till 4-5 requests from the client. Later the server simply stops listening to client. I have tried tcpdump on server side and i do recieve the TCP packet from the client. So it means there is some bug at server side. I am not sure if i have done something wrong or some bug in core library... I am confused as the code works for 4-5 request and then simply starts ignoring the client messages. Is g_io_add_watch ignoring the incoming signals?? thats what i can detect from my gdb tracing there is no invocation of my function even if i recieve a packet on server side from the client in summary function calls: -socket(AF_INET,SOCK_STREAM,0) -bind(sockfd, (struct sockaddr *)serv_addr, sizeof(serv_addr))) -listen(sockfd,5) -accept(sockfd, (struct sockaddr *) cli_addr, clilen) -g_io_channel_unix_new (global_sock) -g_io_add_watch(listenonsocket, G_IO_IN | G_IO_PRI,read_request,global_sock) Rehan, What is listenonsocket ? Why no G_IO_HUP ? the above sequence is correct; however the api values seem to be wrong and in the wrong order! Post or include the real code. As an example, look at the code in this sample sknet for the following url. http://mysite.verizon.net/skoona/id1.html James, -g_io_channel_read(channel,len,sizeof(len),bytes_read); I hope somebody comes to my rescue its been now 3 days i am trying to solve this problem but no success... Thanks in advance for all great coders Regards, RS. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK Thread init problem
On Tue, 2007-04-17 at 13:56 +0530, prabahar k wrote: Hi Thanks Tristan for u r suggestion for using g_thread_create. Thanks James for u r nice code. Also If we want to retain the p_thread_create() in the program then its enough to change the compile time flags to include `pkg-config --cflags --libs gtk+-2.0 gthread-2.0` Its working fine. Here is the code: /**gtk19mod.c compile: gcc -g -o gtk19mod gtk19mod.c `pkg-config --cflags --libs gtk+-2.0 gthread-2.0` / #include gtk/gtk.h #include glib.h #include pthread.h pthread_t thrd1; void destroy (GtkWidget *widget, gpointer data) { gtk_main_quit (); } void *argument_thread (void *args) { for (;(*(gboolean *)args);) { /* sleep a while */ g_usleep(100); g_print(Inside thread); } g_thread_exit (NULL); OK, but don't mix the threading api's. remove the g_thread_exit(). For portability and stability - I always use glib's threading apis when using GTK/GDK. James, return NULL; } int main (int argc, char *argv[]) { GtkWidget *window; gboolean b_run_flag = TRUE; /* init threads */ g_print(Going thread init\n); g_thread_init (NULL); gdk_threads_init (); gdk_threads_enter (); gtk_init(argc, argv); g_print(After init\n); /* create a window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (destroy), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_widget_show (window); pthread_create (thrd1, NULL, argument_thread, (void*)b_run_flag); gtk_main (); gdk_threads_leave (); b_run_flag = FALSE; return 0; } /End***/ On 4/17/07, James Scott Jr [EMAIL PROTECTED] wrote: On Mon, 2007-04-16 at 18:09 +0530, prabahar k wrote: hi i am trying to use a threaded GTK program. While running theprogram it gives segmentation fault and it seem to be anthread init problem. is there any thing i am missing? Pleasegive u r comments. the code is:/***gtk19.c**/#include stdio.h#include stdlib.h#include unistd.h#include time.h#include gtk/gtk.h#include glib.h#include pthread.h pthread_t thrd1; void destroy (GtkWidget *widget, gpointer data){ gtk_main_quit ();} void *argument_thread (void *args){gdk_threads_enter (); for (;;) { /* sleep a while */ sleep(1); g_print(Inside thread); }gdk_threads_leave (); return NULL;} int main (int argc, char *argv[]){ GtkWidget *window; /* init threads */ g_thread_init (NULL); gdk_threads_init (); /* init gtk */ gdk_threads_enter ();/*[Line :70] */gtk_init(argc, argv); g_print(After init\n); /* create a window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (destroy), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_widget_show (window); pthread_create (thrd1, NULL, argument_thread, NULL); gtk_main (); gdk_threads_leave (); return 0;}/**/ I compile it asgcc -Wall -g gtk19.c -o base -lpthread `pkg-config --cflags gtk+-2.0``pkg-config --libs gtk+-2.0` `gtk-config --cflags --libs gthread` --- prabahar ___gtk-app-devel-list mailing [EMAIL PROTECTED]://mail.gnome.org/mailman/listinfo/gtk-app-devel-list prabahar, I just modified your code to show the needed changes. Notice that the gdk_threads_enter/leave is removed from the thread and the thread is created using glib's api. I also updated the includes and compile command. 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
Re: GTK Thread init problem
On Mon, 2007-04-16 at 18:09 +0530, prabahar k wrote: hi i am trying to use a threaded GTK program. While running the program it gives segmentation fault and it seem to be an thread init problem. is there any thing i am missing? Please give u r comments. the code is: /***gtk19.c**/ #include stdio.h #include stdlib.h #include unistd.h #include time.h #include gtk/gtk.h #include glib.h #include pthread.h pthread_t thrd1; void destroy (GtkWidget *widget, gpointer data) { gtk_main_quit (); } void *argument_thread (void *args) { gdk_threads_enter (); for (;;) { /* sleep a while */ sleep(1); g_print(Inside thread); } gdk_threads_leave (); return NULL; } int main (int argc, char *argv[]) { GtkWidget *window; /* init threads */ g_thread_init (NULL); gdk_threads_init (); /* init gtk */ gdk_threads_enter (); /*[Line :70] */gtk_init(argc, argv); g_print(After init\n); /* create a window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (destroy), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_widget_show (window); pthread_create (thrd1, NULL, argument_thread, NULL); gtk_main (); gdk_threads_leave (); return 0; } /**/ I compile it as gcc -Wall -g gtk19.c -o base -lpthread `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` `gtk-config --cflags --libs gthread` After core dump bt gives #0 0x00484aa2 in pthread_mutex_lock () from /lib/libpthread.so.0 #1 0x0025f63a in g_mem_chunk_new () from /usr/lib/libglib-2.0.so.0 #2 0x002408c6 in g_ptr_array_sized_new () from /usr/lib/libglib-2.0.so.0 #3 0x002408e3 in g_ptr_array_new () from /usr/lib/libglib-2.0.so.0 #4 0x00146f0d in gdk_x11_atom_to_xatom () from /usr/lib/libgdk-x11-2.0.so.0 #5 0x00146f7b in gdk_atom_intern () from /usr/lib/libgdk-x11-2.0.so.0 #6 0x001454d9 in gdk_keymap_translate_keyboard_state () from /usr/lib/libgdk-x11-2.0.so.0 #7 0x0011267e in gdk_pre_parse_libgtk_only () from /usr/lib/libgdk- x11-2.0.so.0 #8 0x00598330 in gtk_disable_setlocale () from /usr/lib/libgtk-x11-2.0.so.0 #9 0x00264c8c in g_option_context_parse () from /usr/lib/libglib-2.0.so.0 #10 0x00598789 in gtk_parse_args () from /usr/lib/libgtk-x11-2.0.so.0 #11 0x005987c3 in gtk_init_check () from /usr/lib/libgtk-x11-2.0.so.0 #12 0x00598801 in gtk_init () from /usr/lib/libgtk-x11-2.0.so.0 #13 0x08048be7 in main (argc=2, argv=0xbfab7144) at gtk19.c:70 --- prabahar ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list prabahar, I just modified your code to show the needed changes. Notice that the gdk_threads_enter/leave is removed from the thread and the thread is created using glib's api. I also updated the includes and compile command. James, BEGIN CODE *** /***gtk19m.c**/ /* gcc -O2 -Wall `pkg-config --cflags --libs gtk+-2.0 glib-2.0 gthread-2.0` gtk19m.c -o gtk19m */ #include gtk/gtk.h #include glib.h void destroy (GtkWidget *widget, gpointer data) { gtk_main_quit (); /* the window is almost invalid when this is called */ /* consider delete-event */ } /* * Does not need gdk_threads_enter/leave() wrapping * if no GTK/GDK apis are called */ gpointer argument_thread (gpointer *args) { for (;(gboolean)*args;) /* exit loop when flag is cleared */ { /* sleep a while */ g_usleep(100); g_print(Inside thread); } g_thread_exit (NULL);/* not required just good pratice */ return NULL; } int main (int argc, char *argv[]) { GtkWidget *window; GThread *gth = NULL; /* thread id */ gboolean b_run_flag = TRUE; /* used as exit flag for threads */ g_thread_init (NULL);/* Initialize GLIB thread support */ gdk_threads_init (); /* Initialize GDK locks */ gdk_threads_enter ();/* Acquire GDK locks */ gtk_init(argc, argv); /* initialize GTK*/ g_print(After init\n); /* create a window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), destroy, GTK_SIGNAL_FUNC (destroy), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_widget_show (window); /* Create a bg thread using glib */ gth = g_thread_create ( (GThreadFunc)argument_thread, (gpointer)b_run_flag, TRUE, NULL); gtk_main (); /* --- ANYTHING EXECUTED VIA THIS LOOP HAS GDK LOCKS ALREADY APPLIED */ gdk_threads_leave (); /* release GDK locks */ b_run_flag = FALSE; /* flag threads to stop and exit */ g_thread_join(gth); /* wait for thread to exit */
Re: how to read data with g_io_read_channel throwed it through a normal socket
On Thu, 2007-04-12 at 13:36 -0700, nahuel9728 wrote: Hi everyone. Im developing a interface for a server program and I have some problems.Step by step: - I put the server in listen: fd_dealer2server=socket.. bind listen(fd_dealer2server,MAX_CON) - I create a channel and I add a watch to the the port binded for everytime a data goes in io = g_io_channel_unix_new (fd_dealer2server); if (!g_io_add_watch (io, G_IO_IN, (GIOFunc) my_func, NULL)){g_error } -Tll here everything its ok Later in my_func: static void my_func (GIOChannel *gio, GIOCondition condition, gpointer data){ guint mensaje[1]; gsize bytes_read; if(g_io_channel_read (gio, (gchar *) mensaje , sizeof(mensaje) , bytes_read) != G_IO_ERROR_NONE){ g_warning(Error\n); } And Finally I have my client binded to the shame port fd=socket connect(fd, int sms = atoi(argv[2]); send( fd, sms, sizeof(int) ,0); It catch the event G_IO_IN but g_io_read doesnt works..Always get error. Any hint??? Regards to every1, Nahuel Nahuel, You need to perform the socket accept() before the g_io_channel_unix_new() is called. The http://gfhcmd.sourceforge.net/ package contains a gfhcmd server module and the gfhcmc contains its matching client; I offer them as a example of using g_io_channel... with sockets and gtk/glib. Here is an example routine that picks up where you left off (at the listen). You should find the select(), then accept(), then the g_io_channel_unix_new() calls. [CODE] /* * Accept a TCP connection, waiting for upto 80 seconds. * Returns NULL on error, or connected GIOChannel * */ extern GIOChannel *sknet_net_accept(PSKCOMM psk) { socklen_t clilen = sizeof(struct sockaddr_in); intnewfd; struct sockaddr_in client_addr; GIOChannel*ioc = NULL; gint rc = 0, ecount = 0; fd_set fdset; struct timeval timev, *tv = NULL; g_return_val_if_fail (psk != NULL, NULL); /* * Wait on an incoming connection */ ecount = 0; tv = timev; rc = 0; while ( rc = 0) { timev.tv_sec = 8; timev.tv_usec = 0; FD_ZERO(fdset); FD_SET(psk-fd_server, fdset); if ( ecount 10 ) { g_snprintf(psk-ch_error_msg, sizeof(psk-ch_error_msg), accept select(failed), retry=%d {%s}, ecount, g_strerror(errno)); psk-ioc = NULL; return NULL; } rc = select(psk-fd_server+1, fdset, NULL, NULL, tv); if ( rc == 0 ) { continue; } /* timed out */ if ( rc == -1 ) { g_snprintf(psk-ch_error_msg, sizeof(psk-ch_error_msg), tv.sec=%d, retrying=%d {%s}, (int)timev.tv_sec, ecount, g_strerror(errno)); sknet_util_log_msg(sknet_net_accept, accept select() failing, psk-ch_error_msg); g_usleep(100); } /* error */ ecount++; } /* end-while */ /* * Prepare to accept the connection */ memset (client_addr, 0, sizeof(struct sockaddr_in)); newfd = accept(psk-fd_server, (struct sockaddr *)client_addr, clilen); if (newfd 0) { sknet_util_log_msg(Net_Accept issue , newfd0, (gchar *)g_strerror(errno)); g_snprintf(psk-ch_error_msg, sizeof(psk-ch_error_msg),sknet_net_accept(%s), (gchar *) g_strerror (errno)); psk-ioc = NULL; return NULL; /* error */ } /* * get session partners name */ getnameinfo ((struct sockaddr *)client_addr, clilen, psk-ch_ip_client, sizeof(psk-ch_ip_client), psk-ch_ip_client_port, sizeof(psk-ch_ip_client_port), NI_NUMERICSERV); ioc = g_io_channel_unix_new( newfd); g_io_channel_set_encoding (ioc, NULL, NULL); g_io_channel_set_buffered (ioc, FALSE); psk-ioc = ioc; return ioc; } [/CODE] ___ gtk-app-devel-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Fw: Thread-save posting of events
[ this repeats the note with better formatting; hopefully] Tobias, This response may be a little off topic. But as I have followed this thread I understand your are moving some application to linux from MS. Moreso, you are planning on using gtk to get that port done. Here is a little of my experience with gtk threaded program design. 1. Having gtk thread security features turned on is required if you plan to call gtk_ api's from more than one thread: Which you should NOT try to do. * If your app will be multi-threaded be sure to enable these protection feature as described. http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html * And use the glib set of api's for creating and managing threads, as described here: http://developer.gnome.org/doc/API/2.0/glib/glib-Threads.html 2. Spend some time devising a way to collect data values that need to be visually represented in gtk inside a container or memory structure that you can g_new0() allocate. * Then pass that pointer from the background thread to the foreground GTK main thread for display or updating ** maybe using GAsyncQueue to pass the pointers ** GAsyncQueue will also cause a thread to block; good for background threads waiting on work, BAD for the GTK main thread and its contructs. ** apis which act on the GAsyncQueue behave somewhat like the MS postMessage() api *** the sendMessage is synchronous and has no GTK/GLIB equivilent. One way to overcome this is to actually share a set of user.functions() and a common memory structure using glib's g_mutex apis. Be sure to call these shared(between threads) user.functions from a g_idle/g_timeout based functions in the gtk main thread when targeting the gui. *** If you don't call any gtk/gdk api's from another thread then you will not need to call gdk_threads_enter/exit() ** For gtk main thread to background thread interchanges look over the g_idle/g_timeout set of apis and potentially g_io_channel/watch apis; along with g_mutex 'es where needed. *** gapcmon.sourceforge.net, gfhcm.sourceforge.net contain working examples of tcp socket intensive gtk/C programs using these methods. ** If you look at how gtk suggest you setup for multi-threaded program, it describes wrapping the call to gtk_main() with ( gdk_threads_enter(); gtk_init(); gtk_window...;gtk_main();gtk_threads_exit() ). What is not so obvious is that this protects most button and g_signal callbacks. g_idle... g_timeout... g_thread... based functions are not protected by the gtk_main loop because they occur outside its control - so they must have gdk_threads_enter/exit wrappings just arround the gtk_... call only. *** You need to consider using gdk_threads_enter/exit in any g_idle/g_timeout/g_thread/g_io_ based routine *** if you follow me thus far, then you will never call a gtk/gdk routine from outside the gtk_main loop or thread; except for maybe g_io_watch based functions. 3. Socket based, and other OTHER PROCESS, communication wheter a pipe or a socket or orther mechanism may lend itself to g_io_channel and g_io_watch based apis. ** Look at a few example of how the glib feature set works; it ends up executing during the gtk_main loop thread/time be can be very useful in handling external process based communication. ** If you find that this (g_io_watch() ) method works for you, consider creating your own glib loop (g_main_loop_run()) in a background thread to get your io processing off the gtk_main timeslice 4. Finally, be careful how you implement or use classic unix signals: Danger, Danger Will Robinson.. I can not stress enough that you need to buy the book, readit, and workout some off-project tests before pounding out a ported application. You will find gtk/glib to have a rich set of widgets and programming constructs that make using it almost fun. I hope some of what I've said help your quest. James, (a.k.a Skoona) - Original Message From: [EMAIL PROTECTED] [EMAIL PROTECTED] To: Tobias Rapp [EMAIL PROTECTED] Cc: gtk-app-devel-list@gnome.org Sent: Thursday, March 29, 2007 4:15:54 AM Subject: Re: Thread-save posting of events On 3/29/07, Tobias Rapp [EMAIL PROTECTED] wrote: Rick Jones wrote: I've only come across it while looking for other things, but perhaps the GAsyncQueues stuff would be useful for thread-to-thread comms? http://developer.gnome.org/doc/API/2.0/glib/glib-Asynchronous-Queues.html That looks exactly like the thing I'm searching for. I had a look at the API documentation before but don't know how I missed that one. Thanks! You probably still need watch routines executing the the various event loops (guessing). Yes, maybe I have to add an idle handler for the event loop with g_idle_add() (as proposed by John) and do a g_async_queue_try_pop() in there... Actually no, you can just
Re: is there a g_option_print_usage() command?
On Mon, 2007-03-12 at 12:08 -0700, Rick Jones wrote: I see that goption can uatomagically handle --help and the like. I'd like to emit a usage string when someone gives a bogus option - is there a call one can make to just print the same stuff that goption does on its own with --help, or do I have to mess about with error hooks? http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html didn't mention one - before I use something I find from source I'd want to check that it was simply an oversight in the api docs :) thanks, rick jones ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Rick, The link you supplied gave a partial example that works. However, here is a full example; notice the if statement around g_option_context_parse(). BEGIN EXAMPLE /* gapc_notify.c20070123 libnotify messaging routine for Linux scripting languages. output a titled message box to the graphical screen for 10 seconds Copyright (C) 2007 James Scott, Jr. [EMAIL PROTECTED] Compile Requirements: { tested on FC6 } libnotify-0.4.2 libnotify-devel-0.4.2 gtk-2.6+ glib-2.6+ Compile Command: $ gcc `pkg-config --cflags --libs libnotify` -o gapc_notify gapc_notify.c Usage: $ ./gapc_notify -s 5 -t title of messagebox -m message in the box or $ ./gapc_notify --help GPL2 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include libnotify/notify.h #include stdio.h #include unistd.h static gchar *gd_pch_title; static gchar *gd_pch_body; static gchar *gd_pch_icon; static gint gd_i_seconds; int main(int argc, char * argv[] ) { NotifyNotification *nctx; GError *gerror = NULL; GOptionContext *context = NULL; GOptionEntry entries[] = { {title, 't', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, gd_pch_title, Title text on msg box, Uninterruptible Power Supply}, {message, 'm', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, gd_pch_body, Message body text, message}, {icon-name, 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, gd_pch_icon, icon to include next to message, gtk-dialog-info ...-warning ...-error}, {show-seconds, 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT, gd_i_seconds, seconds to display message, 10}, {NULL} }; /* Get command line parms */ context = g_option_context_new ( - APCUPSD Commandline Notification Utility GPL2 [2007] [EMAIL PROTECTED]); g_option_context_add_main_entries(context, entries, NULL); g_option_context_set_ignore_unknown_options(context, FALSE); if (!(g_option_context_parse(context, argc, argv, gerror))) { g_warning (Parse command line failed: %s, gerror-message); g_option_context_free(context); g_error_free(gerror); return (1); } if (gd_pch_title == NULL) { gd_pch_title = Uninterruptible Power Supply; } if (gd_pch_body == NULL) { gd_pch_body = message; } if (gd_pch_icon == NULL) { gd_pch_icon = gtk-dialog-info; } if (gd_i_seconds 1 ) { gd_i_seconds = 10; } notify_init(gapc_notify); nctx = notify_notification_new (gd_pch_title, gd_pch_body, gd_pch_icon, NULL); notify_notification_set_timeout (nctx, (gd_i_seconds * 1000) ); // 10 seconds if (!notify_notification_show (nctx, NULL)) { fprintf(stderr, failed to send notification\n); return 2; } g_object_unref(G_OBJECT(nctx)); notify_uninit(); return 0; } END EXAMPLE James Scott, Jr. Registered Linux User #270764 FC6 on Dual AMD-MP 2400+ Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net http://mysite.verizon.net/skoona/index.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: trying to launch a dialog from outside the main gui thread by emiting a signal to the thread.
On Tue, 2007-03-06 at 12:45 -0500, Kevin Lambert wrote: I am currently working on a multithreaded application which has a primary GUI that is always running and I need to be able to get that GUI to show a popup to put images in. The problem I am having is how do I tell the GUI to show the popup from outside of its own code? As a test I connected the keys-changed signal for the GUI's window so that if that signal gets emitted it launches my dialog. I then added an external function which emits that signal which, when called, crashes the application with: Xlib: unexpected async reply (sequence 0x995)! Xlib: sequence lost (0x108c7 0xfd) in reply type 0x8! Xlib: sequence lost (0x1 0xfd) in reply type 0x0! I do know that only the primary GUI thread is allowed to handle X calls which is why I had the signal handler launching my dialog. I have tried googling for information but Im not finding much. Thanks, Kevin Kevin, There several ways to communication between threads, and there are some design options available which depending on what your doing may not require you to create a formal thread. First communications between threads: GASyncQueue This glib allows api allows you to allocate a structure or pointer, fill it with the logical message, and post it asynchronously to the foreground GUI thread for formatting into a displayed message. This approch assumes async messages are ok. If its not1. , create a second queue, and after posting to display_que have the background thread read from the done_que - it will sleep until the foreground displays the message and post the original (or any) pointer to the Done_que. How does the foreground pickup the message. Start a g_timeout_add() function to peak at the queue every x seconds, then read que if peak counts is more than 0. Be sure to return true to keep the g_timeout_add() routine running, otherwise false will make it stop. Alternates to formal threads. g_idle_add() g_io_watch() g_io_timeout_add() Hopefully you have the application devhelp and can look up these api's. James, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list James Scott, Jr. Registered Linux User #270764 FC6 on Dual AMD-MP 2400+ Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net http://mysite.verizon.net/skoona/index.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problems with Threading Concept
; } } int main(int argc, char *argv[] ) { GtkWidget *window; GtkWidget *button; g_thread_init (NULL); gdk_threads_init (); /*-C gdk_threads_enter (); -- too early */ gtk_init (argc, argv); /* create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (gtk_main_quit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 100); button = gtk_button_new_with_label(click it); g_signal_connect (G_OBJECT (button), clicked, G_CALLBACK (hello_print), NULL); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show (button); gtk_widget_show (window); gdk_threads_enter (); /*-C -- correct place for this */ gtk_main (); gdk_threads_leave (); return 0; } James Scott, Jr. Registered Linux User #270764 FC6 on Dual AMD-MP 2400+ Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net http://mysite.verizon.net/skoona/index.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk box and flow layout
daa84, You may want to explore using the GtkLayout container. From what I know of the Java FlowLayout, both GtkTable and GtkLayout are close approximations of the FlowLayout. http://developer.gnome.org/doc/API/2.0/gtk/GtkLayout.html On Sun, 2007-02-18 at 11:14 +0300, daa84 wrote: Hello! Can I create flow layout box in gtk like java FlowLayout Layout Manager? Or it is need to create derivative class (from GtkTable for example) and release it behaviour itself? Thanks. Sorry for my bad english:) James Scott, Jr. Registered Linux User #270764 FC6 on Dual AMD-MP 2400+ Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net http://mysite.verizon.net/skoona/index.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: libglade frustration redux - back away from the keyboard
Geraldi, I take notice of the following comment. I give up! I throw in the towel. This is certainly your option, but I will tell you that your experience with libglade is typical for persons who approach programming the wrong way. Let me suggest an alternative that WILL yield different and better results. First, this gtk application developers mailing list is monitored by some of the original authors of gtk and many many developers who have acquired a significant level of skill. Collectively we can help anyone with a programming problem, and as you have seen from the rambling of this thread - we clearly have opinions. Let break this un-productive cycle and fix something. What your programing problem? I assume you have a small outline, maybe the first steps. Post them and I will send you back a working GTK sample which you can use to get started; and ask clarification questions based on a working sample. It seems you have be pointed to a wealth of resources related to GTK and LibGlade. Ignore libglade for the moment, lets focus on GTK for now. Also, a great development information tool for GTK is 'DevHelp', most destro's include by default. I personally use 'Eclipse' as my development IDE with the CDT plugin. Fedora Core 5/6 include these two tools by defaults. Also, have a look as some of the source code I share from this website http://mysite.verizon.net/skoona/index.html;. Nothing special, but it may give you ideal on how to organize your questions and ideals. Here is one book I found very useful for reference and learning GTK: The official GNOME2 Developers Guide and the GTK tutorial, installed with GTK already on your machine; look for /usr/share/doc/gtk2-devel-2.10.8/tutorial/book1.html in your filesystem. There are a few 'AH' 'HA' moments that you must acquire/experience/endure related to event programming; but they are neither hard nor complex - just some basic rules to follow when organizing your code. I will help, and I know others will help answer questions related to GTK programing. How can we help you? James Scott, Jr. Registered Linux User #270764 FC6 on Dual AMD-MP 2400+ Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net http://mysite.verizon.net/skoona/index.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: scrolledview
On Thu, 2007-02-08 at 05:53 +, [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wed, Feb 07, 2007 at 08:32:26PM +0100, Mehmet YASAR wrote: [EMAIL PROTECTED] a écrit : [...] how can I know that all the widget have done their size negotiations ? I can't rely on the realized signal since the gtkvbox is already realized ... I'd put my bets on the widget's size-allocate signal -- but I don't know for sure. I had already done some experimentation and I've found that widgets may get more than one size-allocate signal. [...] Yes, I suppose you'd have to track the size as it changes. If you have to do an action hwenever the size really, truly changed (meaning it has been displayed and all is quiescent), perhaps an idle handler would be the right place. Regards - -- tomás -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFFyrrRBcgs9XrR2kYRAv5IAJ492lpDlVYRLNQMTW5tyQg7tyzCtQCfdpVr CbfgmDGn4JNUmPkHHam9lZI= =UcZq -END PGP SIGNATURE- Mehmet, An idle handler would be a good fit here. I assumed that you are creating and filling textviews during the startup of your program and possibly before you enter the main_loop or gtk_main. Or possibly in a routine that does everything at once. Here is the potential problem: your create and populate actions require some additional gtk messages to be processed, which are waiting to get serviced by the gtk_main() loop. So thing s will not appear to settle down until after the gtk_main has been allowed to run. Using an idle handler puts your call to a Position/Size routine at the back of the waiting queue of needed messages, so by the time it's processed the other messages have done their job and all the textviews/scrollbars/gtkvboxes, and scrolled windows have settled down. -- wait, this assumes you issued a gtk_widget_show{_all} on the main window containing all this stuff! Its the gtk_widget_show that starts the cascade of messages which includes the size and realize messages. g_idle_add() or g_timeout_add(250,...) show do the trick. James, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list James Scott, Jr. Registered Linux User #270764 FC6 on Dual AMD-MP 2400+ Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net http://mysite.verizon.net/skoona/index.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: scrolledview
On Tue, 2007-02-06 at 21:40 +0100, Mehmet YASAR wrote: Hi, I need some advice about scrolled views. I have a gtkscrolledview containing a gtkvbox, I'm adding many gtktextviews to the vbox. I'd like to select which gtktextview is displayed when I call gtk_widget_show(gkvbox). The problem I have is related to the fact that each widget have a different height, so size negociation with the gtkvbox takes many steps. I can't find the FINAL height of the gtkvbox (after all the widgets have been added and their height allocated), so I am unable to scroll to the correct position before gtk_widget_show. If you have caused the GtkVBox to be Realized, meaning all the widget have done their size negotiations, then to get the x/y position of the desired GtkTextView - relative to the GtkVBox, you can try something like this. if ( GTK_WIDGET_REALIZED(gvbox) ) { GTK_WIDGET(gkvbox)-allocation.height; /* this is the allocated height */ GTK_WIDGET(desired_gtktextview)-allocation.y; /* this would be your scroll to point to display this widget */ /* this point is inside the gvbox's height range */ } Hope this helps James, Can someone help me ? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list James Scott, Jr. Registered Linux User #270764 FC6 on Dual AMD-MP 2400+ Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net http://mysite.verizon.net/skoona/index.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: using GtkPlot from Gtk+Extra without canvas
- Original Message From: Tristan Van Berkom [EMAIL PROTECTED] To: François Galea [EMAIL PROTECTED] Cc: gtk-app-devel-list@gnome.org Sent: Tuesday, January 9, 2007 1:04:42 PM Subject: Re: using GtkPlot from Gtk+Extra without canvas On Tue, 2007-01-09 at 18:41 +0100, François Galea wrote: Tristan Van Berkom a écrit : On Tue, 2007-01-09 at 15:27 +0100, François Galea wrote: hi, [...] The results are a bunch of messages of the form : (plot2:3556): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed Hi, those assertions mean that the widget you are trying to realize is not anchored - that means that its not inside a toplevel widget. by looking at your code, looks like you never add the gtk-plot widget to your hierarchy. Hi Tristan, Thank you for your quick answer. Adding the GktPlot to the hierarchy doesn't help much. It just suppresses the error messages, but doesn't display anything either. If I'm not mistaken, GtkPlot is a GtkWidget, so it must be in the hierarchy to be displayed - I thought that the critical messages were a good hint for that. Now I dont know about GtkPlot itself, but I suppose once its in the hierarchy it should display itself - now, what exactly is a GtkPlot ? what does it display ? did you give it any content to display ? A widget with no content to display should typically size-request to take no space (for example a GtkLabel with a zero length string) - probably leaving you with a grey background. In fact, I just would like to be able to draw a plot in a drawable widget, such as a drawing area. It seems the GtkPlot is not drawable by itself (eg. creating a pixmap using plot-window as a reference GdkDrawable displays a Gdk error message), thus the idea of using a GtkDrawingArea. Maybe I am wrong, please correct me if so. creating a pixmap using plot-window as a reference GdkDrawable What does that mean ? Cheers, -Tristan François, I know a little about GtkPlot, and there is an example that ships with the package. Tristan is correct, it is a self contained widget and needs to be added to your window hierarchy and made visible to be displayed. Further you need to use its api's to create series data to have that series data plotted. It is not a general purpose plotting area, so you must restrict yourself to using its api's for everything to maintain the desired visual. I need to review your code again to better answer your question, I will post again after I do. Until then you can do two things 1) review GtkExtras/GtkPlot sample programs to better understand how the package works, 2) look at this code which produces a simple 2D linegraph and maybe use to to write your own routine: http://sourceforge.net/project/showfiles.php?group_id=157888 (Get the glinegraph...bz2 sub-package) 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
Re: How does one pipe output from process to text buffer? -- FIXED
On Sun, 2006-12-31 at 05:43 +, [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sat, Dec 30, 2006 at 12:15:33AM -0500, Tony Freeman wrote: Thanks everyone, I have this working now :-) Special thanks to Tomas! happy it helped :-) Still strange that it blocks, though. Perhaps g_spawn_async_with_pipes(...) gives you channels in blocking mode (I'd doubt that, but I don't know for sure). You might try this out e.g. with g_io_channel_set_flags(gioout, G_IO_FLAG_NONBLOCK | g_io_channel_get_flags(gioout)), err); /* or NULL, if you live on the edge */ right after the gioout = g_io_channel_unix_new(...) g_io_channel_...() could be buffering the input/output. try adding a g_io_channel_set_encoding(gioout, NULL, NULL); after the g_io_channel_new() call. Also, the following text may provide some insight. The default encoding for GIOChannel is UTF-8. If your application is reading output from a command using via pipe, you may need to set the encoding to the encoding of the current locale (see g_get_charset()) with the g_io_channel_set_encoding() function. If you want to read raw binary data without interpretation, then call the g_io_channel_set_encoding() function with NULL for the encoding argument. James, Regards - -- tomás -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFFl04NBcgs9XrR2kYRAlG+AJ9LCauFArjjFzraf0GTLQ4Z+6oOUQCdFYt6 US5gnFcIbPS44N0OoxYrvA4= =8p1T -END PGP SIGNATURE- ___ 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: Proper way to show unique icon in treeview --with code
Tony, I don't claim to be an expert but I have used IconViews TreeViews. I have never seen it attempted the way you show. Using GDK_TYPE_PIXBUF as the column type is all I have every tried, based on code I've seen from others, and it has always worked. Here are a few observation of your code. 1. I have been successful using the following creation order. A. Load all icons I plan to use into an array of *pixbuf or some type of permanent(life of the app) container. B. Create the list store model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF, /* ICON */ G_TYPE_STRING /* Location Name */ )); C. Create the iconview (or treeview) show it, plan on adding it to a scrolled_window. iconview = gtk_icon_view_new_with_model (GTK_TREE_MODEL (model)); gtk_icon_view_set_orientation (GTK_ICON_VIEW (iconview), GTK_ORIENTATION_VERTICAL); gtk_icon_view_set_columns (GTK_ICON_VIEW (iconview), -1); gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (iconview), GTK_SELECTION_SINGLE); gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (iconview), ID_SEL_ICON); gtk_icon_view_set_markup_column (GTK_ICON_VIEW (iconview), ID_SEL_LABEL); D. Load each record to the list store with a pointer to pixmap, and text string gtk_list_store_prepend (GTK_LIST_STORE (model), iter); gtk_list_store_set (GTK_LIST_STORE (model), iter, ID_SEL_ICON, pixbuf, ID_SEL_LABEL, Home, -1); Iconviews don't need all the renderer fuss and may work well for you. gfhcm.sourceforge.net contains an application i wrote that uses both icon views and tree views, look at the gfhcm-client or gfhcmc codeset. You might also find answers for the GTK API Docs or the TreeView tutorial. http://developer.gnome.org/doc/API/2.0/gtk/TreeWidget.html http://developer.gnome.org/doc/API/2.0/gtk/GtkIconView.html http://scentric.net/tutorial/treeview-tutorial.html Hope this helps, James, On Sun, 2006-12-17 at 23:06 -0500, Tony Freeman wrote: Hello, I need help understanding how one would create a treeview so that the first column is an icon and the second column is text. The icon and text represent the type of machine the user can choose (linux workstation, linux server, hp). I want to have a different icon for each machine; however, I notice that whatever icon is called last in the code that I have written, is the icon that is shown for ALL the rows. Please help! What am I doing wrong? I forgot to attach the code! Here it is: void build_server_list (GtkWidget *treeview) { GtkListStore *liststore; GtkTreeIter iter; GtkCellRenderer *text_renderer; GtkCellRenderer *icon_renderer; gint i = 0; gint count = 0; icon_renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview), 0, , icon_renderer, NULL); text_renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview), 1, , text_renderer, NULL); liststore = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING); /* workstations */ count = g_strv_length(workstations); g_object_set(icon_renderer, stock-id, gtk-close, NULL); for (i=0; icount; i++) { gtk_list_store_append(liststore, iter); gtk_list_store_set(liststore, iter, 0, icon_renderer, 1, workstations[i], -1); } /* linux servers */ count = g_strv_length(servers_linux); g_object_set(icon_renderer, stock-id, gtk-save, NULL); for (i=0; icount; i++) { gtk_list_store_append(liststore, iter); gtk_list_store_set(liststore, iter, 0, icon_renderer, 1, servers_linux[i], -1); } /* hp servers */ count = g_strv_length(servers_hp); g_object_set(icon_renderer, stock-id, gtk-open, NULL); for (i=0; icount; i++) { gtk_list_store_append(liststore, iter); gtk_list_store_set(liststore, iter, 0, icon_renderer, 1, servers_hp[i], -1); } gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(liststore)); }
RE: Linux signals and GLIB g_io_channel usage
On Mon, 2006-11-13 at 02:15 -0500, Freddie Unpenstein wrote: On Mon 10/23, James Scott Jr [EMAIL PROTECTED] wrote: I am about to write the socket module of a program that follows the gnu standard structure for a daemon. I am using glib wherever possible and have a question concerning the use of linux signals. Basically, I have blocked all signals on all threads according to the standard daemon model and use a single thread with a sigwait() to process the ones I'm interested in; like SIGHUP to reload the config file. I'm curious, to know where this documentation is... Happen to have a URL handy? The docs are also in most devhelp installations, try $ devhelp on your console. http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html Fredderic ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! ___ 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: Linux signals and GLIB g_io_channel usage
On Mon, 2006-11-13 at 17:02 -0800, C.R. Kirkwood-Watts wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 James Scott Jr wrote: On Mon, 2006-11-13 at 02:15 -0500, Freddie Unpenstein wrote: On Mon 10/23, James Scott Jr [EMAIL PROTECTED] wrote: I am about to write the socket module of a program that follows the gnu standard structure for a daemon. I am using glib wherever possible and have a question concerning the use of linux signals. Basically, I have blocked all signals on all threads according to the standard daemon model and use a single thread with a sigwait() to process the ones I'm interested in; like SIGHUP to reload the config file. I'm curious, to know where this documentation is... Happen to have a URL handy? The docs are also in most devhelp installations, try $ devhelp on your console. I assumed that the question pertained to the gnu standard structure for a daemon part of your post. In either case, I would like to know whence _that_ documentation. Chris. Ok, I may have misunderstood the question, as my answer related to g_io_channel... usage. If I am back on track, the standard daemon model is based on my interpretation of google results where like these: http://www.linuxprofilm.com/articles/linux-daemon-howto.html http://www.enderunix.org/documents/eng/daemon.php . Where a particular sequence of startup steps are repeated over and over throughout multiple search hits. The summary statement gnu standard structure for a daemon is solely my observation, and not official. Additionally, this daemon search lead me to look for additional info on linux signals and posix threads; where the Linux Journal and Advanced Linux Programming yeided the best answers. Here are couple links related to signal handling with multiple posix threads - http://www.linuxjournal.com/article/2121, and http://www.linuxjournal.com/article/3985 . I hope this is what your after. James, Registered Linux User #270764 FC5 on Dual AMD 2400+ MPs ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Linux signals and GLIB g_io_channel usage
Folks, I am about to write the socket module of a program that follows the gnu standard structure for a daemon. I am using glib wherever possible and have a question concerning the use of linux signals. Basically, I have blocked all signals on all threads according to the standard daemon model and use a single thread with a sigwait() to process the ones I'm interested in; like SIGHUP to reload the config file. Question: Will having all signals blocked interfere with the normal operation of glib, in such a way that that I need to rethink how to handle signals? I plan to use g_io_channel...() and g_io_add_watch() to handle asynchronous reads from sockets. This is what I mean by signals blocked. /* block all signals */ sigfillset (signal_set); pthread_sigmask (SIG_BLOCK, signal_set, NULL); if (i_debug != 88) { /* Fork off the parent process */ if ( (daemon (0, 0) ) != 0) { g_warning (Fork() Failure -- shutdown); exit (EXIT_FAILURE); } /* Change the file mode mask */ umask (0); } Thanks in advance. James, Registered Linux User #270764 FC5 on Dual AMD 2400+ MPs ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Linux signals and GLIB g_io_channel usage
On Mon, 2006-10-23 at 13:42 -0400, Tristan Van Berkom wrote: James Scott Jr wrote: Folks, Hi James, in a phrase - I've done it and it works fine. some places might call for special attention though - for example - if you were to call g_spawn_sync() or g_child_watch(), you may want to have leave SIGCHLD available. Thats what prompted the question. I noticed that I needed to un-block around a call to g_spawn_command_line_async() and wondered if I was getting into trouble on this path. Now I will only unblock SIGCHLD around those calls instead of all signals. Thanks for the quick response. Cheers, -Tristan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Fwd: Systray icon..
I was able to compile it, after a few minor changes. If you wanting to use it on a linux platform download my example for this url. http://mysite.verizon.net/skoona/id2.html The example program demonstrates adding and removing an icon, adding tooltips, popup-menus to an icon, etc. Let me know, if you cannot compile my example. James, On Mon, 2006-08-14 at 00:35 -0500, Samuel Cormier-Iijima wrote: eggstatusicon. it was a while ago, so maybe they've updated it, but I remember that eggtrayicon was what i needed (putting an icon in the systray) On 8/14/06, James Scott Jr [EMAIL PROTECTED] wrote: Tried compiling what? eggtrayicon.c, edgestatusicon.c ? What was the error-code/messages ? James, On Sun, 2006-08-13 at 10:58 -0500, Samuel Cormier-Iijima wrote: I tried compiling it once, and it didn't seem to work with GTK 2.0... :-) On 8/13/06, Enrico [EMAIL PROTECTED] wrote: Fernando Apesteguía pronuncio' le seguenti parole il 11/08/2006 17:09: Using eggtrayicon.c and eggtrayicon.h Best regards Many thanks for the help! I have noticed that there is also an edgestatusicon.c and an edgestatusicon.h, what is the difference? Thanks Enrico ___ 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: Fwd: Systray icon..
Tried compiling what? eggtrayicon.c, edgestatusicon.c ? What was the error-code/messages ? James, On Sun, 2006-08-13 at 10:58 -0500, Samuel Cormier-Iijima wrote: I tried compiling it once, and it didn't seem to work with GTK 2.0... :-) On 8/13/06, Enrico [EMAIL PROTECTED] wrote: Fernando Apesteguía pronuncio' le seguenti parole il 11/08/2006 17:09: Using eggtrayicon.c and eggtrayicon.h Best regards Many thanks for the help! I have noticed that there is also an edgestatusicon.c and an edgestatusicon.h, what is the difference? Thanks Enrico ___ 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: Systray icon..
Here is an example of using eggtrayicon.c and eggtrayicon.h http://mysite.verizon.net/skoona/id2.html James, On Fri, 2006-08-11 at 17:05 +0200, Enrico wrote: Hi at all! How can I display an icon in the system tray without using GtkStatusIcon (I've only GTK 2.8). Many thanks! Enrico ___ 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: C/GTK question
On Thu, 2006-06-15 at 12:08 -0300, Matías Torres wrote: I'm building an application in C that uses GTK. The reason i'm doing this is to learn GTK (and C as well) the main problem I've found is that i write all the GTK code in only one file and is getting too da## big, so i tried to divide the GTK code in different files, but it seems i'm do not understand C that good. This is what i did: global.c GtkWidget *mainWindow gtkarch1.c gtkarch2.c gtkarch3.c gtkarch4.c /* Al this files uses the mainWindow variable, this is what i do: gtkarchX.c #include global.c GtkWidget *mainWindow */ ** Remove this from all X.c files. It is the cause of your compiler error. ** ant then the main.c file which looks like this: main.c #include gtkarch1.c #include gtkarch2.c #include gtkarch3.c But the compiler gives me an error, which I understand but i don't know how to solve it, that says that i'm redefining the variables declared in global.c in each gtkarchX.c ** By including the other C files from the main.c file the compiler treats the set of files as if they were just one big file named main.c. James, So Help? please? ___ 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
[Fwd: Re: How to get the the current size of a widget?]
Luis If you look at the GtkWidget structure you will find it contains an GtkAllocation allocation, which is a simple rectangle. It is set to the widget's current size by the configure or realize event of all widgets. You can use its value reliably almost anytime after the gtk_main() has had an opportunity to run and start processing events/messages. example: widget-allocation.x widget-allocation.y widget-allocation.width widget-allocation.height http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkAllocation James, Forwarded Message From: Luis Menina [EMAIL PROTECTED] To: heavenscape [EMAIL PROTECTED] Cc: gtk-app-devel-list@gnome.org Subject: Re: How to get the the current size of a widget? Date: Fri, 02 Jun 2006 23:12:58 +0200 Use the configure-event event... It's not well documented in GTK doc: http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-configure-event But the pygtk help tells it's called when the window changes its size http://pygtk.org/pygtk2reference/class-gtkwidget.html#signal-gtkwidget--configure-event Cheers Luis heavenscape a écrit : I am displaying a image in my main window, and I want it to automatically resize with the main window. Can anyone tell me how to get the current size of the main window or any widget from within a callback? Regards! -- View this message in context: http://www.nabble.com/How-to-get-the-the-current-size-of-a-widget--t1721682.html#a4676723 Sent from the Gtk+ - Apps Dev forum 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 ___ 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
Creating custom widget questions
Folks, I am creating a xy linegraph widget for the first time, and I am experiencing a double destroy method call during shutdown. Plus, I would like some clarification on which api family to use for params ;GtkObject or GObject, and a little help with naming a new widget. I'm using gtk2-devel-2.8.17-1.fc5.1 Q1: Naming a new widget: Is it ok to name it gtk_linegraph_new() ? - I named mine sk_linegraph_new(), but all the books i've read did not hesitate to prefix their names with gtk_ Q2: API Families: GtkObjectClass vs GObjectClass for widget properties? - I want the codeset to run anywhere GTK+/GDK is supported! - I used GObjectClass methods ( get/set_property ) rather than GtkObjectClass get/set_arg - initially not noticing the difference; does it matter ? Q3: Double-Destroy method calls: GtkWidgetClass-destroy get called at least twice during shutdown and GTK_DESTROYED(widget) didn't seem to work? - With this widget and a few others, I've noticed that the destroy method is called multiple times at program termination - I included my realize/unrealize() methods as they are the only methods related to this problem that I could find. - Is there a GTK2 equivalent of GTK_DESTROYED(widget), to help detect the 2nd+ call ? - Is this a problem? can I safely ignore it? [ FILE sklinegraph.h] typedef struct _SkLineGraph { GtkWidget widget; ... } SkLineGraph; typedef struct _SkLineGraphClass { GtkWidgetClass parent_class; } SkLineGraphClass; [ FILE sklinegraph.c] G_DEFINE_TYPE (SkLineGraph, sk_linegraph, GTK_TYPE_WIDGET) static void sk_linegraph_class_init (SkLineGraphClass *class) { GObjectClass*gobject_class = G_OBJECT_CLASS (class); GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class= GTK_WIDGET_CLASS (class); gobject_class-set_property = sk_linegraph_set_property; gobject_class-get_property = sk_linegraph_get_property; gtkobject_class-destroy= sk_linegraph_destroy; widget_class-size_allocate = sk_linegraph_size_allocate; widget_class-size_request = sk_linegraph_size_request; widget_class-realize = sk_linegraph_realize; widget_class-unrealize = sk_linegraph_unrealize; widget_class-expose_event= sk_linegraph_expose_event; widget_class-motion_notify_event = sk_linegraph_motion_notify_event; widget_class-button_press_event = sk_linegraph_button_press_event; g_object_class_install_property (gobject_class,PROP_GRAPH_DRAWING_TYPE, g_param_spec_boolean (graph-drawing-type, Graph Drawing Type, some text, FALSE, G_PARAM_READWRITE)); } static void sk_linegraph_realize (GtkWidget *widget) { SkLineGraph *slg = NULL; GdkWindowAttr attributes; gint attributes_mask; g_return_if_fail ( widget != NULL); g_return_if_fail (IS_SK_LINEGRAPH (widget)); slg = SK_LINEGRAPH (widget); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget-allocation.x; attributes.y = widget-allocation.y; attributes.width = widget-allocation.width; attributes.height = widget-allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget-window = gdk_window_new (gtk_widget_get_parent_window (widget), attributes, attributes_mask); gdk_window_set_user_data (widget-window, widget); widget-style = gtk_style_attach (widget-style, widget-window); gtk_style_set_background (widget-style, widget-window, GTK_STATE_NORMAL); if (slg-lgflags LG_GRAPH_SCALED) { sk_linegraph_manage_scaled_config (slg); } else { sk_linegraph_manage_regular_config (slg); } } static void sk_linegraph_unrealize (GtkWidget *widget) { g_return_if_fail (widget != NULL); g_return_if_fail (IS_SK_LINEGRAPH (widget)); if (GTK_WIDGET_CLASS (sk_linegraph_parent_class)-unrealize) (* GTK_WIDGET_CLASS (sk_linegraph_parent_class)-unrealize) (widget); } James, Registered Linux User #270764 FC5 on Dual AMD 2400+ MPs ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Is it possible to implement Zoom/Shrink of a backing bitmap using only GTK+/GDK/GLIB ?
Folks, I am writing a simple GTK+ line graph codeset to use in my GTK applications; It's done but not a widget yet. After reading several books and googling I still have this question. Question: Is it possible using only GTK+/GDK/GLIB to create a 2000x2000 pixbuf for drawing and have the expose-event scale it to the current window size? It seems a gnome-canvas has the notion of world coordinates and transforms; but I don't see this in regular GTK/GDK/GLIB. I have already done this using OpenGL and would like to simply use GTK without all the fluff. If its possible/practical - can someone point me to the right source to learn how to do this zooming thing? or even suggest a few api as a starting point. I looked at void gdk_region_shrink(GdkRegion *region, gint dx, gint dy);, but I'm not sure it will do what I'm after. James, Registered Linux User #270764 FC5 on Dual AMD 2400+ MPs ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Random Number of Buttons
On Thu, 2006-04-20 at 18:40 -0700, 3saul wrote: OK what I'm trying to do is this: 1. Read a directory full of images (the images in the directory will change) 2. Create a table with the correct number of cells. 3. Put a button in each cell with an image on it from the directory 4. In the cell below the image put the name of the file on a label I've seen GTKIconView but that seems complicated to me (I'm a beginner) Using an GtkIconView will be easier than anything else I can think of. Take the challenge and use the treeview. Here is my favorite tutorial for treeview in general: http://scentric.net/tutorial/treeview-tutorial.html Here is a link to an complete example using the full GtkTreeView: http://scentric.net/tutorial/sec-treeview-col-pixbufs.html James, -- View this message in context: http://www.nabble.com/Random-Number-of-Buttons-t1480088.html#a4019004 Sent from the Gtk+ - Apps Dev forum 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 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+ 2.8.17 and background colours
On Fri, 2006-04-21 at 20:36 +0200, Francesco Montorsi wrote: Hi, I'm struggling with my GTK+ (2.8.17 - coming with ubuntu dapper) to be able to set the background colour of a button. I've googled and searched the archives of this mailing list and I have found exactly same questions with attached test programs. I'm attaching two short, simple test programs which *should* be able to set the background colour of a button to a different colour from the standard one. Unfortunately running them I don't see any difference with a standard GtkButton: i.e. the calls to gtk_widget_modify_bg and gtk_widget_modify_fg seems not to have any effect ! Could anyone more expert try to compile those files and run them to see if they get standard colours or not ? (to compile them I usually place them in the gtk\examples\helloworld folder and rename them to helloworld.c ;)) This seems like a GTK+ bug to me... Thanks a lot, Francesco The biggest tip I can share is If the desired widget does not have a GtkWindow of its own, it draws on its parent's window!. Now the parent window may not be the one you expect or think you've coded. Use this sequence to change of the color of a widget without its own GtkWindow. GdkColor color; ... gdk_color_parse (blue, color); ... button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); .. gtk_widget_modify_bg ( gtk_widget_get_parent(button), GTK_STATE_NORMAL, color); gtk_widget_get_parent() is the magic api to permit changing colors of widgets reliably. 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
Re: gui, g_objects and abstraction
On Thu, 2006-04-06 at 20:57 +0200, Andreas Kotowicz wrote: this is a general case question. I made myself familiar with gtk+ and created a few useful (and less useful) programs. I quickly began to realize that I do reuse some code very often. So I thought about abstraction and creation of objects and classes which could then be easily reused. so here's my question: does it make sense to create a class/object which only creates the main window. this object will then make a call to a class which creates the UI inside the window. then I might have different main-window-objects (like in evolution where you have a mail/calendar/task window inside the main window) which should get created by the UI class as requested by the user and put between the menu and status bars. of course the window class would create a default object first so the main window wouldn't be empty. is this kind of abstraction useful? or would I just break a fly on the wheel? I tried to study different code (gedit, eog, evolution) but I can't actually see a clear strategy on this issue. I'm welcome for any suggestions / enlightenment. cheers, Andreas Just a response. The effort you project saving is analogous to that saved using GLADE2 or GNOME for development. Both the tool (glade) and the added library (gnome) provide the same type of repetitive saving. I would suggest using gnome, or continuing as you are; if you don't care for generators like glade. The official GNOME2 developer's guide is the best GTK+ and GNOME programming guide I've seen so far. Especially, if your planning to create your own GTK widgets to package feature/functions you use often. James, (Not an Expert..., but fairly experienced) ___ 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: Notification area application
On Thu, 2006-04-06 at 08:44 +0200, Olaf Leidinger wrote: Hello! Unfortunately, I'm not familiar on how to download files from the Gnome CVS site. Could you briefly explain how I would accomplish this download? Have a look at http://developer.gnome.org/tools/cvs.html In your case, open a terminal and write the following: export CVSROOT=:pserver:[EMAIL PROTECTED]:/cvs/gnome cvs login (just press return) cvs -z3 checkout libegg Hope that helps, Ciao, Olaf Leidinger --Signature=_Thu__6_Apr_2006_08_44_54_+0200_n936KMQb7FNESTuF-- ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Bob, Follow the above instructions - its painless. 1. the export command 2. the cvs login command with carraige-return or enter for a password 3. the cvs checkout command to actually copy the files to your current directory 4. done - change directory to ./libegg/libegg/tray/ to see the files. Note with minor adjustments I use the files as-is. Design note: notification area icons work a little differently on other none-gnome platforms. If you need three icons for your app, create three whole icons. Don't do like I did - I created a single vbox and packed three icons into it. Worked fine on gnome, got truncated to one icon worth of space/size on xfce, darwin, and kde. James, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Notification area application
On Sun, 2006-04-02 at 07:37 -0700, BobS0327 wrote: I am trying to develop an application that resides in the notification area of Fedora 5 and version 2.14.0 of the Notification area. I have found some sample code on the internet for a base system tray (notification area) application. It compiles without any problem but no icon appears in the notification area. Thus, can anybody provide any assistance to help me develop this base system tray application? Thanx Bob, You and I may be at the same place in writing code to this interface. I include three links to answer your question. 1. look at libegg/tray and use that code as is or modified. Your already have a notification tray in the gnome panel (or add to panel one), as a target for this code. This code also includes a test program for the two type/styles of tray_icons. http://cvs.gnome.org/viewcvs/libegg/?only_with_tag=MAIN 2. Some guidance on how/when to use a notification area versus a gnome-panel-applet. http://developer.gnome.org/projects/gup/hig/2.0/desktop-notification-area.html 3. The FreeDesktop.org spec or description of the notification area protocol. http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html Hope this helps, James, Bob -- View this message in context: http://www.nabble.com/Notification-area-application-t1382780.html#a3713241 Sent from the Gtk+ - Apps Dev forum 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 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list