Re: saving window size?
Look at GtkWidget::delete_event signal. On Tue, 2009-01-20 at 09:26 -0500, Dr. Michael J. Chudobiak wrote: Hi all, Suppose I have an app, and I would like to save the window size when when quitting. This is easy to do if the user selects File-Quit, but what if they click window-close? By the time you get the destroy signal, the true width/height values are gone. (You seem to get the default values.) Is there a resize signal I can listen to? Here's what I have, in vala: window.destroy += quitSave; //quit menu item Action quit = (Action)builder.get_object(menubar_quit); quit.activate += (quit) = {quitSave (window);}; ... private void quitSave(Window window) { var gc = GConf.Client.get_default (); int width = 0; int height = 0; window.get_size (out width, out height); if (width 0) gc.set_int (/apps/moserial/ui/window_width, width); if (height 0) gc.set_int (/apps/moserial/ui/window_height, height); Gtk.main_quit (); } Suggestions? - Mike ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Alexander Semenov bohtva...@gmail.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: valgrind reports memory leak on g_main_loop_run
Sune Ahlgren wrote: Hi, I use 1 GMain event loop in my main context for monitoring of events on file descriptors. I shut down my program by receiving a SIGTERM. In this signal handler I do the following: g_main_loop_quit(loop); g_main_loop_unref(loop); loop = NULL; I've also tried to move: g_main_loop_unref(loop); loop = NULL;to the very end of my main function. I still get: ==6087== 744 bytes in 3 blocks are possibly lost in loss record 7 of 9==6087== at 0x4021C8A: memalign (vg_replace_malloc.c:460)==6087==by 0x4021D3E: posix_memalign (vg_replace_malloc.c:569)==6087==by 0x409391E: (within /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x40950F2: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x404F55E: g_array_sized_new (in /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x404F676: g_array_new (in /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x40A0423: g_static_private_set (in /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x4075A43: (within /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x407606C: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x4079852: (within /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x4079D71: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.1600.6)==6087==by 0x806F805: init (init.c:193) I set up the main loop like this: loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); What am I doing wrong? BRs /Sune _ Senaste sportnyheterna rykande färska resultat! http://sport.msn.se/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Hi. T popular kind of question. Are you aware of http://live.gnome.org/Valgrind ? Regards. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How can I wrap or scroll text inside a GtkLabel to keep the width?
Guenther Meyer wrote: hi, I have GtkLabels packed inside some vboxes or tables, the width of the box is determined by the size of some other elements (buttons, listviews, ...). when the text inside the labels is changed, and this text is too long to fit, the box automatically resizes, which distorts the whole window layout and pushes some widgets off the screen. so how can I fix the width of the GtkLabel (which I don't know at creation), and let the text automatically wrap or scroll, if it doesn't fit? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Hi. voidgtk_label_set_ellipsize (GtkLabel *label, PangoEllipsizeMode mode); Sets the mode used to ellipsize (add an ellipsis: ...) to the text if there is not enough space to render the entire string. Regards. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: glib main loop without gtk
Thomas Stover wrote: So if one wants to use g_io_channels with out gtk (console / server app), what exactly is the idea? Does glib need an initialization function called first? I see the g_main_loop_new() and friends functions, and that part make sense. The thing is g_io_add_watch_full() type functions don't have a main loop parameter. In other words were does this default main loop come from? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list From giochannel.c: guint g_io_add_watch_full ( GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify) { GSource *source; guint id; g_return_val_if_fail (channel != NULL, 0); source = g_io_create_watch (channel, condition); if (priority != G_PRIORITY_DEFAULT) g_source_set_priority (source, priority); g_source_set_callback (source, (GSourceFunc)func, user_data, notify); id = g_source_attach (source, NULL); g_source_unref (source); return id; } g_source_attach docs say: Adds a GSource cid:part1.08000109.07070102@gmail.com to a /|context|/ so that it will be executed within that context. /|source|/ : a GSource cid:part1.08000109.07070102@gmail.com /|context|/ : a GMainContext cid:part3.06080301.01060802@gmail.com (if |NULL| cid:part4.06010104.01000906@gmail.com, the default context will be used) /Returns/ : the ID (greater than 0) for the source within the GMainContext cid:part3.06080301.01060802@gmail.com. From gmain.c (g_source_attach func): if (!context) context = g_main_context_default (); So, main loop is found throw GMainContext. Regards. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: glib main loop without gtk
Alexander Semenov wrote: Thomas Stover wrote: So if one wants to use g_io_channels with out gtk (console / server app), what exactly is the idea? Does glib need an initialization function called first? I see the g_main_loop_new() and friends functions, and that part make sense. The thing is g_io_add_watch_full() type functions don't have a main loop parameter. In other words were does this default main loop come from? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Oops, sorry for formatting (copy-paste from devhelp). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How can I tell which window manager my app is running under?
Hi, Justin. gdk_x11_screen_get_window_manager_name () On Sat, 2008-04-19 at 23:48 +1000, Justin Clift wrote: Hi, How can I tell which window manager my application is running under? Can't seem to see any kind of Gtk nor Gdk calls to determine this. The end result I'm trying to achieve is bind of the Control-Printscreen key to a specialised screen capture utility. Figured out a solution that works for metacity (writing to it's registry), however each different window manager requires a different approach. So, I'm looking for a way to tell which approach to use. Regards and best wishes, Justin Clift ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: key press events SUPR
Hi, Martin. From the GTK+ documentation for GdkEventKey: guint keyval; the key that was pressed or released. See the gdk/gdkkeysyms.h header file for a complete list of GDK key codes. On Thu, 2008-04-17 at 04:56 -0500, [EMAIL PROTECTED] wrote: hi all: I am working with gnome-ruby today and i have a question common in all GTK APIS. are they always the key codes the same in all platforms?? I want to catch the SUPR button @window1.signal_connect(key-press-event) do |widget,event| if event.keyval==65535 puts be happy my friend you push the supr keyboard button! end end are there MACROS to solves this problems??? Regards. ___ 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: Callback Question
Hi. Perhaps, this discussion was related to threads? Thank you all for this! Especialy for the long example, but, it was just an example. I've made an application that works perfectly on Linux but in Window$ it crashes a lot! I've been trying to find a solution (actually a clue of what the problem might be) in any discussion I was able to find about GTK crashes in the internet. In one of these discussions it was said that gtk functions can't be called inside callbacks, that it wasn't safe yet. That, if you call any gtk function inside a callback, it should be done using g_object_idle_add. Unfortunatly I didn't check the date of the discussion, maybe, it is too old. Thanks. Matías. ___ 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 text to a GdkPixbuf
Hi. What about drawing GdkPixbuf and then your text on GdkWindow? On Mon, 2008-04-14 at 12:05 +0200, Francesco Sepic wrote: Hello, is it possible to draw text on a GdkPixbuf using Pango? gdk_draw_text () takes a GdkDrawable as the destination on which draw text. Is it possible to get a GdkDrawable from a GdkPixbuf? Thanks. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Draw text to a GdkPixbuf
Why don't you want to draw the text you need in your expose function? You simply redefine the GtkWidgetClass expose-event and draw there. On Mon, 2008-04-14 at 12:55 +0200, Francesco Sepic wrote: On Mon, Apr 14, 2008 at 12:31 PM, Alexander Semenov [EMAIL PROTECTED] wrote: Hi. What about drawing GdkPixbuf and then your text on GdkWindow? I'm drawing a scale bar on a map and I'd like to have different types of scale bar. The position of the text that i have to draw (for example 50 km) depends on specific scale bar. So i want to create different functions that return a GdkPixbuf with the text already rendered. Thanks. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list