Re: Need to restore a window to last size/position on restart
On Mon, Jan 15, 2007 at 09:29:56AM -0800, Russell Markus wrote: I need to be able to restore the size and position of a dialog whenever the application starts. I am using the function calls: gtk_window_get_size(GTK_WINDOW(dialog1), w, h) and gtk_window_get_position(GTK_WINDOW), x, y) However, no matter what I do to the window, resize or move, these two functions always return the same values. I get 0, 0 for the x and y position and 448, 196 for the width and height. Can someone point me to the correct functions to be using? These are the correct functions. I have no idea why they do not work for you. Post some code... Also, which functions to use to set the location and size. See gtk_window_get_position() docs on why this sometimes does not work as expected. Use gtk_window_set_default_size() to set the default size. Use gtk_window_move() to move the window. Call it twice: once when it's not shown yet, second time immediately after showing it (this works reasonably across window managers). Ensure the values you are saving are not bogus (e.g. when the window is minimized) and you are not restoring it bigger than the screen, offscreen... Yeti -- Whatever. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
How does one set background color for entire line in textview?
Hello, I have a function that takes the output of a spawned process and displays that in a text buffer (part of a notebook widget). When the spawned process is finished, I'd like to put some colorized text at the bottom of the text buffer/view that alerts the user that the process is done. What I want is the entire line to have a background color of blue. The code that I have so far just displays the blue background under the text. How do I make the entire line blue? switch (status) { case G_IO_STATUS_NORMAL: return TRUE; default: /* Use a tag to make the DONE notification noticeable */ tag = gtk_text_buffer_create_tag ( buffer, done_notification, foreground, white, background, blue, justification, GTK_JUSTIFY_CENTER, background-full-height, TRUE, NULL); start_byte = gtk_text_buffer_get_char_count(buffer); gtk_text_buffer_insert(buffer, iter, \n--\nDONE\n--\n, -1); end_byte = gtk_text_buffer_get_char_count(buffer); gtk_text_buffer_get_iter_at_offset (buffer, start, start_byte); gtk_text_buffer_get_iter_at_offset (buffer, end, end_byte); gtk_text_buffer_apply_tag (buffer, tag, start, end); end_mark = gtk_text_buffer_create_mark( buffer, end_mark, end, FALSE); gtk_text_view_scroll_to_mark(textview, end_mark, 0.0, FALSE, 0.0, 0.0); return FALSE; } -- Tony ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
thread stack size
Hi all, I'm trying to figure out why gthumb uses so much memory, even when it is displaying an empty folder. I've figured out that it is launching 6-8 threads, which each consume 10 MB each of writeable/private memory. pmap -d shows: mapped: 141352Kwriteable/private: 76352Kshared: 516K If I patch the code to use 64k stack size for new threads, like this: - priv-thread = g_thread_create (load_image_thread, il, TRUE, NULL); + priv-thread = g_thread_create_full (load_image_thread, il, 65536, TRUE, FALSE, G_THREAD_PRIORITY_NORMAL, NULL); memory consumption drops dramatically (and the program still works): mapped: 91284Kwriteable/private: 25872Kshared: 516K (There are still 2-3 10MB stacks that I don't understand fully yet). The gnome api says Only use g_thread_create_full() if you really can't use g_thread_create() instead. Why not? Are there any real downsides here? - Mike ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: cannot set tooltips over a picker widget?
Jim George ha scritto: If you know how to make it work automatically for GTK_NO_WINDOW widgets... I read that GtkLabel widgets don't have backing windows, for performance reasons. I haven't read any such comment about, say, GtkComboBoxEntry widgets. Maybe the documentation needs to be updated? I, for one, would like to see something like a table for all standard widgets with a column for GTK_NO_WINDOW that says 'yes' or 'no', rather than having to find out for myself by trial and error. I agree - such list would be very useful. BTW thanks to everyone for the help - I somehow missed that note on the docs page about windowless widgets. Thanks, Francesco PS: sorry george, I first sent the mail only to you because of that unhappy reply-to choice for this list :( -- Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
how to increase refresh rate in Wireshark IO Graph
Hi, I was looking for a real-time network traffic graph generator, and the best I've found was of course in Wireshark. Still, it has a refresh rate of 3 seconds on my computer, even if my processor is 95% idle. The reason seems to be a lazy refresh from Gtk, and I don't know how to give it some priority. Or should I explicitly trigger the refresh somehow? I was trying to do a quick fix, but I've never been dealing with Gtk before. Anyone have an idea how to make it faster? What I've done as a quick and ugly fix was adding a g_timeout_add_full () to the end of gtk_iostat_init() to schedule some periodic redraw events. The one linr of code I've added was something like the following (sorry, no diff, I do not have the source here with me): g_timeout_add_full (G_PRIORITY_DEFAULT, 100, io_stat_redraw, io, NULL); (of course some other code is needed to clean up when the window is closed) This one line reduced the refresh rate to 1 sec, already much better, but I wasn't able to go below, even if I set the priority higher or the event rate to some milliseconds. I'm sure someone knowing Gtk can achieve much better with the right one line of code. Anyone knows the solution? Thanks, Csaba ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Dynamically Changing Icons for the Applications.
Hi All, My Requirement: Change the icons for an icon view dynamically Same as we change Themes. My knowledge: Using gtkrc files sets the property at the widget level ( as in Notebook tabs, slider, widgets etc) GtkIcontheme can be used for this purpose, but not sure whether we can dynamically change the icons as its done with Themes. Pls clarify. Rgds, Madhusudan E, HTIPL, Bangalore-08 - 9980527224 www.huawei.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: move cursor with keyboard in a window
when in started, i thought about gtkdatabox, but i didn't find nothing about gtkdatabox for windows system. Do you know something about gtkdatabox under windows?? thanks a lot again... ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Problems with GtkFrame
Hi! I write a small application which show a small window. And this a GtkFrame. And this does not work correct. Here is my source code --snip-- gtk_init(argc, argv); window = g_object_new(GTK_TYPE_WINDOW, title, PACKAGE_STRING, type, GTK_WINDOW_TOPLEVEL, resizable, FALSE, window-position, GTK_WIN_POS_CENTER, NULL); frame = g_object_new(GTK_TYPE_FRAME, label, , shadow-type, GTK_SHADOW_ETCHED_IN, border-width, 10, NULL); gtk_container_add(GTK_CONTAINER(window), frame); vbox = g_object_new(GTK_TYPE_VBOX, homogeneous, FALSE, spacing, 5, border-width, 5, NULL); gtk_container_add(GTK_CONTAINER(frame), vbox); label = g_object_new(GTK_TYPE_LABEL, label, Searching for devices , NULL); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 2); gtk_widget_show_all(window); usleep(10); while (gtk_events_pending()) { gtk_main_iteration(); } --snap-- frame = g_object_new(GTK_TYPE_FRAME, label, , I need the empty label to get this frame to work. Why that? OS: Debian Etch (testing) Gtk+ 2.8.20 In Debian SID it works CU Michael -- ,''`. Michael Ott, e-mail: michael at zolnott dot de : :' : Debian SID on Thinkpad T43: `. `'http://www.zolnott.de/laptop/ibm-t43-uc34nge.html `- Jeden Mittwoch von 21 - 24 Uhr. Zosh! auf Radio Z. Das Härteste, was der Musikmarkt zu bieten hat. http://www.zosh.de Online hören: http://www.radio-z.net ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Emulating MDI
I've been playing around with a pet GPL project in my spare time which implements a basic MDI interface. Its on gnomefiles at http://www.gnomefiles.com/app.php/CurlyAnkles or you can see screenshots at http://curlyankles.sourceforge.net/widgets_mdi.html I'd get the latest code from CVS as I've done quite a few fixes in the last few weeks. Some hci purists might not like it and no doubt its contains a few hacks, but I've had fun implementing it. - Email sent from www.ntlworld.com Virus-checked using McAfee(R) Software Visit www.ntlworld.com/security for more information ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: how to set gtk global font with code?
On Wednesday 10 January 2007 03:27, lonelycat wrote: Hi all: Can anyone tell me how to set gtk global font with code instead of editing gtkrc file? GtkSettings has a gtk-font-name property representing the default font used by the application. You can extract the settings object with gtk_settings_get_default() and then set the property on it. Chris ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
How to get alignment in treeview
I using gtktreeview with 3 column to display some data. I set alignment Center in header column with gtk_tree_view_column_set_alignment(). And I set alignment data with g_object_set (renderer, xalign, 1.0, NULL); How I get alignment from data ? I try using gtk_tree_view_column_get_alignment(), but i can only alignment from header. thx. Hariyanto. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: how to set gtk global font with code?
On Mon, 15 Jan 2007 12:42:59 + Chris Vine [EMAIL PROTECTED] wrote: On Wednesday 10 January 2007 03:27, lonelycat wrote: Hi all: Can anyone tell me how to set gtk global font with code instead of editing gtkrc file? GtkSettings has a gtk-font-name property representing the default font used by the application. You can extract the settings object with gtk_settings_get_default() and then set the property on it. Chris This also works: #!/usr/bin/perl use warnings; use strict; use Gtk2 '-init'; Gtk2::Rc-parse_string(__); style default { font_name = adobe courier bold 30 } widget * style default __ my $window = Gtk2::Window-new; $window-set_title(Hello world); $window-signal_connect( destroy = sub { Gtk2-main_quit; } ); my $vbox = Gtk2::VBox-new(); $vbox-set( border_width = 10 ); $window-add($vbox); my $label = Gtk2::Label-new('Big Font'); $vbox-pack_start( $label, 0, 0, 5 );# expand?, fill?, padding my $entry = Gtk2::Entry-new(); $vbox-pack_start( $entry, 0, 0, 5 ); my $button = Gtk2::Widget-new( Gtk2::Button, label = Quit ); $button-signal_connect( clicked = \my_quit ); $vbox-pack_start( $button, 0, 0, 5 ); $window-show_all(); Gtk2-main; sub my_quit { print Yee Haw!\n; exit; } __END__ -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to get alignment in treeview
Il giorno lun, 15/01/2007 alle 20.06 +0700, Hariyanto ha scritto: I using gtktreeview with 3 column to display some data. I set alignment Center in header column with gtk_tree_view_column_set_alignment(). And I set alignment data with g_object_set (renderer, xalign, 1.0, NULL); How I get alignment from data ? I try using gtk_tree_view_column_get_alignment(), but i can only alignment from header. g_object_get signature.asc Description: Questa è una parte del messaggio firmata digitalmente ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Simple question.
Anyone have an example of a make file for a GTK application? Just a simple one for a helloworld would do. I am having to move from Eclipse.org to a more standard build system and I havn't dealt with makefiles for years. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Simple question.
On 1/15/07, LWATCDR [EMAIL PROTECTED] wrote: Anyone have an example of a make file for a GTK application? Just a simple one for a helloworld would do. If it's a single file, you can just do: gcc hello.c -o hello `pkg-config gtk+-2.0 --cflags --libs` Put that in a comment on the first line and you can just copy/paste to build. The last time I had to write a makefile by hand I did: -- OUT = myprogram prefix = /usr/local SRCS = \ a_lot_of.c \ source.c \ files.c HDRS = \ some.h \ headers_as.h \ well.h OBJS = $(SRCS:.c=.o) LIBS = `pkg-config gtk+-2.0 --libs` CFLAGS = -g -Wall `pkg-config gtk+-2.0 --cflags` all: $(OUT) $(OUT): $(OBJS) $(LINK.c) $(OBJS) $(LIBS) -o $(OUT) $(OBJS): $(HDRS) tags: $(SRCS) ctags $(SRCS) $(HDRS) clean: -rm -f $(OBJS) -rm -f $(OUT) -rm -f tags install: $(OUT) -mkdir ${prefix} -mkdir ${prefix}/bin -mkdir ${prefix}/share -mkdir ${prefix}/share/$(OUT) cp $(OUT) ${prefix}/bin cp -r data ${prefix}/share/$(OUT) - it's very crude :-( You can autotool your project pretty easily these days, you could consider that too. Autotool is very handy if you can stomach the steep learning curve and the bizarre collection of things it's made out of. The autobook has a simple example: http://sources.redhat.com/autobook/ there's a section on how to autotool an existing project: http://sources.redhat.com/autobook/autobook/autobook_237.html#SEC237 John ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Delay in Displaying Dialog
I'm encountering a problem in an application I'm working on which I don't understand. It may be due to a misconception I have with GTK+ functionality. The application has a main window which comes up with program execution. Further processing is driven by events initiated by the user selecting drop-down menu items from this main window. In one menu item a dialog is displayed where the user selects certain criteria with which to proceed. Upon completion of establishing the criteria the dialog is destroyed and a new dialog is created. Within this new dialog are a couple of boxes and a couple of tables. Within one of the tables is a non-editable text widget with a vertical scrollbar. A gtk_widget_show_all() is issued for this new dialog once it's created, however the dialog is not displayed at this point. Additionally, the first dialog has not yet disappeared from the display. Immediately after creation of this new dialog, text begins to be sent on a somewhat streaming basis to the text widget. After a few seconds the first dialog disappears and the secondary dialog appears. However, the only widget within the secondary dialog which appears is the text widget. No other widgets appear. The appropriate text begins appearing and scrolling within the text widget. But missing are the first four or five lines of text which were (probably) sent to the text widget during the time it was not displayed. After the text being sent to the text widget ends and process flow falls back into gtk_main() then all the other widgets within the secondary dialog appear including the first few lines of text which had been missing. Can anyone give me an idea (or point me someplace) which will tell me what's going on? Thanks. -- Marshall Lake -- [EMAIL PROTECTED] -- http://mlake.net ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Question about write a new scrollbar widget inherit from GtkVScrollbar
Hi, I'm new to write gtk widget. I'm planning to write a picasa style scrollbar, firstly, write vertical one. The new scrollbar inherit from GtkVScrollbar and with a vscale data member: struct _GtkVPScrollbar { GtkVScrollbar vscrollbar; GtkWidget *vscale; } The new scrollbar override realize, map, size request and size allocate and expose. In realize, the new scrollbar calls parent class, GtkVScrollbar's realize. Vscale uses new GdkWindowAttr to create new gdk window for GtkRange's event_window. The widget window use new scrollbar widget's parent window: vscale-window = gtk_widget_get_parent_window (widget); GTK_RANGE (vscale)-event_window = gdk_window_new (gtk_widget_get_parent_window (widget), attributes, attributes_mask); In map, size request and size allocate and expose, parent class' functions of the new scrollbar widget and vscale are called respectively. Now, there is an event window covered on original scrollbar and receives mouse click events, but it is only a gray rectangle. The slider of vscale is not shown correctly. I guess in expose, I can't just call parent class' function directly but should do something more. But I don't have any idea of what to do more. If possible, please give me some point to continue the widget programming. I've read some tutorials but they only said about basic new widget from scratch, draw line or box; another is composite widget inherit from a container, but I prefer inherit from GtkScrollbar. Sorry for my poor English. It' welcome to discuss this issue with me directly. Regards, Eric Tsai ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Delay in Displaying Dialog
On 1/15/07, Marshall Lake [EMAIL PROTECTED] wrote: After the text being sent to the text widget ends and process flow falls back into gtk_main() then all the other widgets within the secondary dialog appear including the first few lines of text which had been missing. This line leads me to believe that you may not be relinquishing control to the Gtk mainloop. When the text comes into the second dialog box, are you locking up the program until it is all read? For instance, are you simply reading from a socket or file descriptor repeatedly until the text has all been received? If so, that's most likely your problem. Gtk doesn't run in a separate thread, so when it is instructed to do something, such as display a widget, it actually queues the work to be performed later, by the Gtk mainloop. When a function of yours is called, such as a callback for a button being pressed, it is the mainloop which actually does the calling, and it is done with the expectation that the function will do its work quickly, and then return, allowing the mainloop to continue running, and dispatching input events, redrawing widgets, etc. If one of your callbacks takes an extended amount of time to do something, the mainloop is unable to run, thus making the UI unresponsive, preventing expose requests from being serviced, and other Bad Things. There are a few different ways around this problem. They all amount to deferring the work until later, and chopping it up into small pieces, so that it never actually blocks the mainloop for a significant amount of time. For example, you can set up an idle handler, which will be called by the Gtk mainloop whenever it doesn't have any other work to do. Inside of this callback, you could check the data source to see if any new data has appeared, and if so, add it to the text widget, and then quickly return (at which point the mainloop would continue running, and actually expose the new text on the screen.) I believe it's also possible to tell the mainloop about a file descriptor which should be watched, and have it call a function whenever new data appears. I have never used this tactic (hopefully someone else can clarify this), but you might try looking at the documentation for the Glib mainloop and the Gtk mainloop, both available at http://www.gtk.org/api/ . Good luck--if this turns out not to be the problem you're having, be sure to send a reply with some more description, and we'll see what we can do. --Matt ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Local version of GTK2
Sorry this is slightly off-topic: The RH machine on which I do some development work (but don't have root access) only has gtk 2.4.13 (it runs KDE). I was able to download gtk2-perl and compile a local version against this old version of gtk+ with no problem. But now, I would like to use some features from gtk 2.6. Is it a big deal to compile a local version of gtk 2.6? Presumably, I will need more recent versions of GLib, Pango, ATK too? Thanks for any help Jeff ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: ProgressBar doesn't pulse
Am Sonntag 14 Januar 2007 04:21 schrieb muppet: On Jan 13, 2007, at 5:54 PM, Ben Staude wrote: Any ideas why it doesn't work? Is this related to some Gtk/KDE interaction? This typically happens when you don't return control the main loop. Does your program respond at all while it's supposed to be pulsing? I am using this as test code (was posted by zentara here: http://www.mail-archive.com/gtk-perl-list@gnome.org/msg00854.html): #!/usr/bin/perl use warnings; use strict; use Gtk2; Gtk2-init(); my $window = new Gtk2::Window; my $pbar = new Gtk2::ProgressBar; $pbar-set_pulse_step(.1); # set_text not allowed in pulser # ! $pbar-set_text('foobar'); my $vb = new Gtk2::VBox(0, 0); my $b = new Gtk2::Button('Quit'); $window-add($vb); $vb-add($pbar); $vb-add($b); $b-signal_connect('clicked', sub {Gtk2-main_quit}); $window-signal_connect('destroy', sub {Gtk2-main_quit}); $window-show_all(); my $timer = Glib::Timeout-add (10,\show_progress); # timer will run until callback returns false Gtk2-main; sub show_progress{ $pbar-pulse(); return 1; } This test script does work as expected on another Linux machine (running Debian Sarge with KDE), but the progressbar looks different (more like gnome, whereas on Kubuntu (where it doesn't work), they have some KDE integration of gtk and therefor a KDE progressbar). You might also try setting the pulse step. The default is 0.1, but you may need a different value for some reason or another. Difficult to tell without more information. Maybe the code above helps sorting out programming issues (as the test script isn't mine:-)). Besides this, I don't know in which direction to search for the cause or provide information? Maybe someone on the list can run the test script on their Kubuntu to find out whether it's related to that? Thanks a lot, Ben ___ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: Local version of GTK2
On Mon, 2007-01-15 at 17:36 +0100, Jeffrey Ratcliffe wrote: Sorry this is slightly off-topic: The RH machine on which I do some development work (but don't have root access) only has gtk 2.4.13 (it runs KDE). I was able to download gtk2-perl and compile a local version against this old version of gtk+ with no problem. But now, I would like to use some features from gtk 2.6. Is it a big deal to compile a local version of gtk 2.6? do you strictly depend on gtk+ 2.6 (embedded development, no cairo)? otherwise, my suggestion would be to use gtk+ 2.10.7. in any case, building and installing a local version of gtk+ is not a big deal; I do it routinely for my development environment for GNOME and for work. a solution for a working sandbox is to get jhbuild from GNOME's SVN repository[1], install it, configure it (it's a matter of a couple of changes in the sample configuration that comes along with it) and then do a: jhbuild bootstrap jhbuild sanitycheck jhbuild build gtk+ which should set everything up for a successful build of the whole shebang. this, alas!, means installing the autotools and python too. otherwise, you should do what jhbuild does for you, and set up a sandbox where installing the dependencies of gtk+: glib, cairo, pango, and atk. Presumably, I will need more recent versions of GLib, Pango, ATK too? and, for gtk+ = 2.8, cairo. ciao, Emmanuele. -- Emmanuele Bassi, E: [EMAIL PROTECTED] W: http://www.emmanuelebassi.net B: http://log.emmanuelebassi.net ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list