building Gtk2.2 from source
Hi! I'd like to start Gzk/Gnome development on my SuSE 8.0 box with Ruby bindings. I cannot install gtk2.2 via apt-get from SuSE repository since the pango package is wrongly build requiring filesystem package whose functionality is already provided. Anyway, I just need libraries for development since at the moment I'm not running Gnome, and therefore I decided to try to build from source trying to isolate development environment from the present system setup. Can someone give me some hint or/HOWTO build gtk2.2 environment not mixing it with my system. What is the easiest way to prepare gtk2.2 development environment? I started with pango since the present SuSE package is too old, but then I had problem that pango was reporting one version of glib, and configure script finding another one etc.. Sincerely, Gour -- Gour [EMAIL PROTECTED] Registered Linux User #278493 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: can you do multiple g_signal_connects?
Hi, Arash Nikkar wrote: > I want multiple methods to be called when a widget is destroyed. So I was > wondering if this would work: You can connect any number of functions to a signal, so it should be fine. John == Current Exhibition: T I T I A N Until 18 May 2003 Advance Booking Recommended Open every day Wed-Sat late opening until 9pm For information and tickets: http://www.nationalgallery.org.uk/exhibitions/titian ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: checking for a blank box?
On Tue, 04 Mar 2003 20:37:53 -0500 Brandon wrote: > What value do I compare the output of gtk_editable_get_text() with in > order to know if the entry box I'm getting text from is empty or not? > I'm using an if statement and have tried to do If > (gtk_editable_get_text(entry,0,-1) == NULL) and it won't make the match > even when I don't input anything into the entry box. I've also tried > comparing to '\0' and 32 (ascii value for a space) and nothing ever > matches. how do i check if a user has inputted anything? The function (actually gtk_editable_get_chars?!) returns a pointer to a string. You should be using strncmp along the lines of: w_text = gtk_editable_get_text(entry,0,-1); if (strncmp("", w_text, 1)) { ... } g_free(w_text); hth, michael ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: building Gtk2.2 from source
Hi Gour, I built gtk2.2 on suse8.0 a few weeks ago and it was slightly painful. I had to install these things in this order (I think). I did come across a guide somewhere, but I seem to have lost the link, sorry. libpng-1.2.5.tar.gz install to /usr/local freetype-2.1.3.tar.gz install to /usr fcpackage.2_1.tar.gzinstall Xft to /usr/X11R6, install fontconfig to /usr glib-2.2.1.tar.gz install all the rest to /usr/local pango-1.2.1.tar.gz atk-1.2.0.tar.gz gtk+-2.2.1.tar.gz This won't break your existing gtk+-1.x installation, but may futz with any gtk2 stuff you have installed. I've not tried the ruby stuff, can't help you there. John == Current Exhibition: T I T I A N Until 18 May 2003 Advance Booking Recommended Open every day Wed-Sat late opening until 9pm For information and tickets: http://www.nationalgallery.org.uk/exhibitions/titian ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_entry_get_text() - having problems with return type
Hi, "Ben LeMasurier" <[EMAIL PROTECTED]> writes: > i am trying to take the contents of of text entry and push them into > gethostbyname(), when I do this I get the error: > > warning: assignment makes pointer from integer without a cast > > gethostbyname() requests a char * > and gtk_entry_get_text() returns G_CONST_RETURN gchar* > > How do I cast this? or do whatever it is so it takes the variable? this should work out of the box. You better show us your code since its likely that you are not doing things the way you told us. Are you at all sure that the warning comes from this particular assignment? Salut, Sven ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Quick newbie question
Hello Ben! Tue, 04 Mar 2003 21:12:33 +, you wrote: > Hey everyone, > I am just starting to get into GTK+ programming, So far I am doing > pretty well but I am stuck at a certain point. I want to have a text > entry and then a button to submit the information - lets just say when > you hit submit, it pops up a new window that shows the information you > had in the box. My problem is that I can't find out how to access the > data from the text entry, once the "clicked" signal is received from > the button. Can anyone help me out here? Sure. There are two ways to do that: either give the address of the entry as the user parameter of the callback (the gpointer data), or use the g_object_set_data on the button, like g_object_set_data (G_OBJECT (button), "text-entry", entry); and then gets the data via g_object_get_data. The first one is a bit faster, but can be hard to use if you need more than one parameter in the button's callback (you'll have then to you a struct, malloc it and then free it...). That's why I often tend to use the second solution if it's not on a perf-critical part of the program (usually, something that happens only once when an user clicks is not). -- Gael Le Mignot "Kilobug" - [EMAIL PROTECTED] - http://kilobug.free.fr GSM : 06.71.47.18.22 (in France) ICQ UIN : 7299959 Fingerprint : 1F2C 9804 7505 79DF 95E6 7323 B66B F67B 7103 C5DA Member of HurdFr: http://hurdfr.org - The GNU Hurd: http://hurd.gnu.org ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkTextView Questions -- please help! =]
On Tue, 4 Mar 2003, Arash Nikkar wrote: > so quick explaination of the code, I have a paned widget, I create 2 scrolled > windows with textviews in them. I create them the same way, and add the to the > panel, then I add the panel to the table. You would think that the size of the > scrolled windows would be the same. I've actually never used a panel, but I did notice you're creating a table of size 1x4. If you're going to do that, why don't you create a vbox instead?? Also, I had a weird problem with a table before and I couldn't understand why...there's a gtk_table_attach that does it with defaults and using it solved my problems. Give that a try as well. > 3) If you look in the code above, you will see the line: > > gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(temp->input), GTK_WRAP_CHAR) My understanding is that GTK_WRAP_WORD breaks lines between words. GTK_WRAP_CHAR can break a line anywhere, even within words. > i was hoping that this would set the scrolled window to wrap text, however, it > does not. In this textview, users will type in text, and then once they hit a > button, it will go to the other textview. Just like a instant message (this is > actually what it is). But for some reason it doesn't work, and as text is typed, > it never wraps. I was wondering if you had any suggestions. Thanks for your help! I still think my original idea of doing it manually (that is, when it gets to the end of a line, erase the current word, add a new line character, and then write the word out) is better as you have more control with what's going on. I don't know word wrapping well in GTK+ (though I use it, but not like what you're doing) but I have a feeling it wouldn't word wrap as text is being typed. Anyway, you say "just like a instant message" system, but perhaps instant message systems also handle this manually?? Ray ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Re: Different Pixbuf on each treeview row - Please help
Sorry can\'t get this working :-( Does anybody have a working example for this ,please? (showing diff pixbufs in a treeview\'s rows??) Thanks >Victor Mierla wrote: >> \\\"For example, you can bind the \\\"pixbuf\\\" property on the cell renderer to a >> pixbuf >> value in the model, thus rendering a different image in each row of the >> GtkTreeView.\\\" >> How can i do this?? >See the example about setting fg/bg colours. >Basically, you have to add a column to the model, then store the colour >name (maybe, for a pixbuf, a ptr to the pixbuf itself?) in it and tell >the cell renderer OF ANOTHER COLUMN to use the previous one as \"source\". >Here\'s some code from one of my current projects: >// Prepare model \"grotte\" (id, nome, catasto, colprot, #att., #foto) >grotte=GTK_TREE_MODEL(gtk_list_store_new(6, G_TYPE_INT, G_TYPE_STRING, > G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT)); >// Init columns for model >v=GTK_TREE_VIEW(LW(src_crit_cave)); >gtk_tree_view_set_model(v, grotte); >c=gtk_tree_view_column_new_with_attributes(\"Nome\", rct, \"text\", 1, > \"foreground\", 3, NULL); >gtk_tree_view_append_column(v, c); >c=gtk_tree_view_column_new_with_attributes(\"Catasto\", rct, \"text\", 2, >NULL); >gtk_tree_view_append_column(v, c); >c=gtk_tree_view_column_new_with_attributes(\"#att.\", rcn, \"text\", 4, > \"foreground\", 3,NULL); >gtk_tree_view_append_column(v, c); >c=gtk_tree_view_column_new_with_attributes(\"#foto\", rcn, \"text\", 5, >NULL); >gtk_tree_view_append_column(v, c); >Column 3 contains colour name (e.g. \"red\" or \"black\") to be used as >foreground for columns 1 and 4. IIUC pixbuf should be similar. >PS: do you know a way to detect if a column haven\'t been initialized? >gtk_tree_model_get_value() segfaults... >BYtE, > Diego. >___ >gtk-list mailing list >[EMAIL PROTECTED] >http://mail.gnome.org/mailman/listinfo/gtk-list Acest email a fost trimis din interfata web http://www.bumerang.ro ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Different Pixbuf on each treeview row - Please help
Victor Mierla wrote: > Sorry can\'t get this working :-( Where's the error? > Does anybody have a working example for this ,please? The code I posted is an actual cut&paste. And IS working. > (showing diff pixbufs in a treeview\'s rows??) Just change "foreground" to "pixbuf" and store a pixbuf in the given column in the model instead of the color name. > >c=gtk_tree_view_column_new_with_attributes(\"Nome\", rct, \"text\", 1, > > \"foreground\", 3, NULL); So this becomes c=gtk_tree_view_column_new_with_attributes("Nome", rct, "pixbuf", 3, NULL); And you have to put the pixbuf in model's column 3. If "it doesn't work", please mail some code explaining what you tried. BYtE, Diego. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
installing gtk
I have a Mandrake 9.0 system that I just recently installed. I went ahead and installed it with the version of gtk and everything needed for it while I was installing. I decided to update it before I started to learn how to program with gtk, and installed the newest version of pkg-config. However when I run configure for glib, it tells me that my version of pkg-config is too old. What do I do? ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Deprecation of gtk_progress_bar_set_bar_style()
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm trying to learn GTK at present (I'm currently reading the API Reference word for word; I probably won't remember squat when I'm done, but at least I'll have an idea of what can be done and where to look to remember how to do it), and the gtk_progress_bar_set_bar_style() function is said to be deprecated. I've searched through the GTK mailing lists trying to find anything about that function, but I couldn't find anything. Why is this function deprecated? Is there another, presumably better way to set whether the bar is discrete or continuous, or was that deemed by someone to be a stupid feature? That seems like a feature I myself would like. Tommy McDaniel -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+ZGAzVB8FYP9YqDcRAl1yAJ4/uKbrfh0+HKhvHk3X1gV/8KrZYACfaO7X hRdo0eE9JqaBkEIhBrSevyk= =IbEE -END PGP SIGNATURE- __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Neural Net
Hey, I'm writing a program to put a fairly complicated GUI on a simple neural network. What I would like is to be able to show nodes in a different color depending on how active they are, to draw links between nodes, to drag nodes onto an "activation" window (or section of window) to activate them continuously, and to be able to alter the weight of this link by clicking on it. I'm a newbie to GTK+, but I've been spending a couple of days looking over the gtkmm documentation. I'm not sure I can do all of the above in GTK+, and I wanted to see what those more experienced than I thought. I think the best approach might be to put the nodes of the net in a DrawingArea widget. That way I can put the links in the picture, and I can figure out what a user clicked on (clumsily) by reading the location of the button_press_event. The problem is that if I want to put a piece of text on that DrawingArea widget, how do I do it? If I put the text in a button or something like that, Pango takes care of things. But to put text in a drawing area, I'd have to generate the letters myself. I'm too lazy to want to do that. Just the same, I can't think of any of the other widgets in GTK+ to make things easier for me. If I could figure out a way to represent links as buttons, then this would be easier, but I'd want to be able to lay out the nodes as I chose. I think this would be doable, but ugly, using a Table widget, with each cell being a pixel? If I could pull that off, is there a way to change the color of a button widget? Like I said, I'm not sure GTK+ and this project are a match made in heaven. Just the same, I'd like very much to use GTK+ for it. Are there tricks to this library that I don't know that would make this job easier? Thanks in advance, Ethan Glasser-Camp ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
GTK+ on Mac OS X?
I'm trying to get up and running with GTK+ development on Mac OS X (n.b., using the real X11 APIs, not the GTK+OSX port which is layered on top of Mac widgets). First question: does anyone know of a build of the GTK+ libraries for OS X that I can just download and use? The GTK+ web site says that such are available for various platforms, but doesn't provide any links, and a web search turned up only GTK+OSX (which isn't what I need). I tried building it myself from sources, but I got stuck trying to build pkgconfig (which is required for GTK+). It fails partway through the make with: gcc -DHAVE_CONFIG_H -I. -I. -I. -DG_LOG_DOMAIN=g_log_domain_glib -g -O2 -Wall -D_REENTRANT -c giounix.c -o giounix.o giounix.c:233: only 1 arg to macro 'g_warning' (2 expected) cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode make[4]: *** [giounix.lo] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all-recursive-am] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all-recursive-am] Error 2 So my second question is, does this give anyone a clue what I must do to get this to compile? If these are dumb questions, please be gentle -- I'm fairly new to X programming. Thanks, - Joe -- ,--. |Joseph J. Strout Check out the Mac Web Directory: | |[EMAIL PROTECTED] http://www.macwebdir.com/| `--' ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: glib-2.2.1: g_print() with UTF-8 characters
Hi, Thanks for your suggestions. > Notes here: > > - Glibc has a "feature" where %Ns actually checks for a whole >number of characters in the current encoding. So, unless you >are sure you are always going to be in an UTF-8 locale, avoid >using %Ns. (You are basically OK for iso-8859-1, but will >have problems in say, a Japanese locale.) It would make sense for g_print() to interpret %Ns correcly since it assumes that the strings passed to it always are encoded in UTF-8. If I could tell glibc that all strings passed to it will be encoded in UTF-8 no matter what the current locale is, then that would solve my problems. Ulf ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
gtkrc-2.0 properties setting for GtkCellRenderer
I don't like the default padding in GtkCellRenderer and would like to be able to set the ypad property globally in my gtkrc. This doesn't seem to work: style "mydefaults" { GtkTreeView::expander_size = 10 GtkTreeView::vertical_separator = 0 GtkCellRenderer::ypad = 1 } class "GtkWidget" style "mydefaults" The expander_size property for the TreeView does work, is there simply no support for rc settings on CellRenderer properties? ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Draw a line & erase it
hi, I want to know how can I do if after I draw a line, and an event ocurres, the line will be erase. there's my code to draw a line. void DibujarLinea(aplicacion_t *a, linea_t *l) { //reserva un espacio en color map para el color gdk_colormap_alloc_color(a->gdkcolormap, &l->lcolor, TRUE, TRUE); //esta función pone el color al gdkgc q se va a dibujar gdk_gc_set_foreground(a->gdkgc, &l->lcolor); gdk_gc_set_line_attributes(a->gdkgc, l->lgrosor, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); gdk_draw_line(a->drawingarea->window, a->gdkgc, l->lx1, l->ly1, l->lx2, l->ly2); } thanks in advance, ana. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Problem with colors
Hi, I've got a problem with the colors. When I draw objects in a window, like lines, circles rectangles, text, I use for each object, a different color, but after that, when any event is in the window, the color changes. any suggestions? here is the code to put the color, (...) r->rcolor.red= 0x; r->rcolor.green= 0; r->rcolor.blue= 0x; (...) gtk_widget_realize(app.window); app.gdkgc= gdk_gc_new(app.window->window); app.gdkcolormap= gdk_colormap_get_system(); (...) void DibujarRectangulo(aplicacion_t *a, rectangulo_t *r) { gdk_colormap_alloc_color(a->gdkcolormap, &r->rcolor, TRUE, TRUE); gdk_gc_set_foreground(a->gdkgc, &r->rcolor); gdk_gc_set_line_attributes(a->gdkgc, r->rgrosor, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); gdk_draw_rectangle(a->drawingarea->window, a->gdkgc, FALSE, r->rx, r->ry, r->ranchura, r->raltura); if (r->rfont == NULL) g_print("rfont is NULL\n"); else gdk_draw_string (a->drawingarea->window, r->rfont, a->gdkgc, r->rx, r->ry-5, r->rnombre); } (...) thanks in advance, ana. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Taking control of a remote program
Hello. Maybe it's a bit offtopic, but I'm interested just in the Gtk case... I'd need to take control of a RUNNING app from another machine. For example, when my mother "locks" my program, I'd like to ssh to that machine (already possible) and then "mirror" on my machine what she sees, so to "unlock" it in a couple of clicks instead of having to phisically go to that machine for the same two clicks... I think it's possible with VNC, but since it's lot of overhead I'd like to know if there's some other way ... BYtE, Diego. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Deprecation of gtk_progress_bar_set_bar_style()
On Tue, 2003-03-04 at 03:13, Tommy McDaniel wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I'm trying to learn GTK at present (I'm currently > reading the API Reference word for word; I probably > won't remember squat when I'm done, but at least I'll > have an idea of what can be done and where to look to > remember how to do it), and the > gtk_progress_bar_set_bar_style() function is said to > be deprecated. I've searched through the GTK mailing > lists trying to find anything about that function, but > I couldn't find anything. Why is this function > deprecated? Is there another, presumably better way to > set whether the bar is discrete or continuous, or was > that deemed by someone to be a stupid feature? That > seems like a feature I myself would like. Allowing to to be app-settable was deemed to be a stupid feature. Why should some apps have progress bars that show discrete blocks, and other apps have progress bars that are continuous? Regards, Owen ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Neural Net
>I'm writing a program to put a fairly complicated GUI on a simple neural netwo >rk. What I would like is to be able to show nodes in a different color dependi >ng on how active they are, to draw links between nodes, to drag nodes onto an >"activation" window (or section of window) to activate them continuously, and >to be able to alter the weight of this link by clicking on it. I'm a newbie to > GTK+, but I've been spending a couple of days looking over the gtkmm document >ation. I'm not sure I can do all of the above in GTK+, and I wanted to see wha >t those more experienced than I thought. use the GnomeCanvas. --p ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Draw a line & erase it
>I want to know how can I do if after I draw a line, and an event >ocurres, the line will be erase. >there's my code to draw a line. you should ONLY draw in an expose event handler. nowhere else, ever. (unless the drawable is offscreen (e.g. a pixmap)). search the archives for discussions of this if you are confused. look for "expose event". ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK+ on Mac OS X?
Hi, have you looked at fink? http://fink.sourceforge.net/ it'll automatically configure, build and install the whole shebang for you. Even if you don't like fink, you can use it to get suggested configure lines, libtool patches etc. It looks like your build is failing because of the apple pre-compiled headers. Try configuring with something like: CFLAGS="-no-cpp-precomp" ./configure --blah if your shell is bash, or setenv CFLAGS "-no-cpp-precomp" ./configure --blah for tcsh or whatever the default one is. John == Current Exhibition: T I T I A N Until 18 May 2003 Advance Booking Recommended Open every day Wed-Sat late opening until 9pm For information and tickets: http://www.nationalgallery.org.uk/exhibitions/titian ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: CellRenderText properties question.
* Diego Zuccato ([EMAIL PROTECTED]) wrote: > "Carl B. Constantine" wrote: > > > Thanks for the reply. That confirms what I suspected, but IMHO very bad > > design as it creates extra overhead for memory and storage in the > > TreeModel (ListStore in this case) instead of being able to determine > > the property programatically. What if I have a preference setting where > > the user change pick a color so it's not just "red" or "blue" it's > > "between blue and purple"? > You can have multiple views on the same model, and tha'ts the real power > of the new widgets over GtkCList and GtkCTree (that, OTOH, are much > faster). > And as Owen said (and I didn't know!) you can have a callback to > calculate on the fly the properties. Indeed. I'll try this a little later today, but if I have the extra data in the model and currently that column has a black setting for each cell, and then I set a cell in that column to "red", will the visible text then automatically change color for that cell? > As you probably already understood, it's not an "hide it" matter. > If you follow the easy way, then you store different attributes in > different MODEL columns. But these columns get ALL referenced when you > add a new column to the VIEW. This way you could have different > attribute sets for different views. again, will try some test code in a couple hours to test this and see what happens, but any pointers you can give would be helpful. -- .''`. Carl B. Constantine : :' : [EMAIL PROTECTED] `. `'GnuPG: 135F FC30 7A02 B0EB 61DB 34E3 3AF1 DC6C 9F7A 3FF8 `- Debian GNU/Linux -- The power of freedom pgp0.pgp Description: PGP signature
Re: glib-2.2.1: g_print() with UTF-8 characters
Hi, Ulf Karlsson <[EMAIL PROTECTED]> writes: > > - Glibc has a "feature" where %Ns actually checks for a whole > >number of characters in the current encoding. So, unless you > >are sure you are always going to be in an UTF-8 locale, avoid > >using %Ns. (You are basically OK for iso-8859-1, but will > >have problems in say, a Japanese locale.) > > It would make sense for g_print() to interpret %Ns correcly since it > assumes that the strings passed to it always are encoded in UTF-8. If > I could tell glibc that all strings passed to it will be encoded in > UTF-8 no matter what the current locale is, then that would solve my > problems. the point is that the string passed from g_print() to glibc is not necessarily in UTF-8 encoding since g_print() does character set conversion to the charset specified by the locale. Salut, Sven ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Transparent Pixbufs
Hi, I'm trying to load a partly transparent image into a pixbuf. Basically, to keep it short, the opaque parts of the image show up with diagonal lines and, I think, black and white. It only happens on an image with transparency with no code changes. I'm guessing this is indicative of something obviously wrong that I've done but I'm not sure what, hope you can help. I've attached a cut-down code sample to show what I'm doing. Thanks, John #include GdkPixbuf *pixbuf; GtkWidget *window; static gint expose_da( GtkWidget *widget, GdkEventExpose *event, gpointer data ) { guchar *pixels; int rowstride; rowstride = gdk_pixbuf_get_rowstride( pixbuf ); pixels = gdk_pixbuf_get_pixels( pixbuf ) + rowstride * event->area.y + event->area.x * 3; gdk_draw_rgb_image_dithalign (widget->window, widget->style->black_gc, event->area.x, event->area.y, event->area.width, event->area.height, GDK_RGB_DITHER_NORMAL, pixels, rowstride, event->area.x, event->area.y ); return TRUE; } int main( int argc, char *argv[] ) { //GtkWidget *da; gint width, height; GdkPixbuf *image; GError **error = NULL; gtk_init( &argc, &argv ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); //da = gtk_drawing_area_new(); g_signal_connect( window, "expose_event", G_CALLBACK( expose_da ), NULL ); image = gdk_pixbuf_new_from_file( argv[1], error ); //gtk_container_add( GTK_CONTAINER( window ), da ); width = gdk_pixbuf_get_width( image ); height = gdk_pixbuf_get_height( image ); //pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE, 8, width, height ); //gdk_pixbuf_copy_area( image, 0, 0, width, height, pixbuf, 0, 0 ); pixbuf = image; gtk_widget_set_size_request( window, width, height ); gtk_widget_queue_draw( window ); gtk_widget_show_all( window ); gtk_main(); return 0; }
Re: Transparent Pixbufs
On Wed, 2003-03-05 at 12:49, John McKerrell wrote: > Hi, >I'm trying to load a partly transparent image into a pixbuf. > Basically, to keep it short, the opaque parts of the image show up with > diagonal lines and, I think, black and white. It only happens on an > image with transparency with no code changes. I'm guessing this is > indicative of something obviously wrong that I've done but I'm not sure > what, hope you can help. I've attached a cut-down code sample to show > what I'm doing. gdk_draw_rgb_image_dithalign doesn't support transparency. Use gdk_draw_pixbuf() instead (GTK+-2.0 called this by the more cumbersome name gdk_pixbuf_render_to_drawable(), if you are using GTK+-1.2, you are out of luck.) Regards, Owen ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_entry_get_text() - having problems with return type
On Wed, 2003-03-05 at 01:16, Raymond Wan wrote: > Hi, > > On Wed, 5 Mar 2003, Ben LeMasurier wrote: > > warning: assignment makes pointer from integer without a cast > > > > gethostbyname() requests a char * > > and gtk_entry_get_text() returns G_CONST_RETURN gchar* > > According to the glib docs, a G_CONST_RETURN gchar* is typedef'ed > to a char* (See glib, basic types in the docs). But, as it stresses in > the gtk_entry_get_text (), you shouldn'tfree, modify, or store it. I > think I malloc'ed a temporary variable of type char * and did a strcpy and > that worked fine. Just don't try storing it with an assignment... What I normally do is use g_strdup (), eg: gchar *name; GtkWidget *name_entry; name = g_strdup (gtk_entry_get_text(GTK_ENTRY(name_entry))); g_print ("The name was: %s\n", name); g_free (name); Keith. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
RE: Running autogen.sh with the example "editor" program
I'm trying to learn more about glade and gtk and have been unable to compile the example "editor" program that is given. I have been running the autogen.sh and it exits on this error: config.status: creating po/Makefile.in config.status: creating m4/Makefile config.status: creating Makefile config.status: creating src/Makefile config.status: creating intl/Makefile config.status: error: cannot find input file: intl/Makefile.in In addition, I went ahead and tried to run "make". This is the output: /usr/local/src/glade-1.1.3/examples/editor# make cd . \ && CONFIG_FILES= CONFIG_HEADERS=config.h \ /bin/sh ./config.status config.status: creating config.h config.status: executing default-1 commands config.status: executing default-2 commands make all-recursive make[1]: Entering directory `/usr/local/src/glade-1.1.3/examples/editor' Making all in m4 make[2]: Entering directory `/usr/local/src/glade-1.1.3/examples/editor/m4' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/src/glade-1.1.3/examples/editor/m4' Making all in intl make[2]: Entering directory `/usr/local/src/glade-1.1.3/examples/editor/intl' make[2]: *** No rule to make target `all'. Stop. make[2]: Leaving directory `/usr/local/src/glade-1.1.3/examples/editor/intl' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/glade-1.1.3/examples/editor' make: *** [all] Error 2 Can anyone help me? I am runing a Slackware Linux 8.1 kernel 2.4.18 with Gnome 1.4.1 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Transparent Pixbufs
On Wed, 2003-03-05 at 17:57, Owen Taylor wrote: > gdk_draw_rgb_image_dithalign doesn't support transparency. > > Use gdk_draw_pixbuf() instead (GTK+-2.0 called this by the more > cumbersome name gdk_pixbuf_render_to_drawable(), if you are > using GTK+-1.2, you are out of luck.) Thanks, yeah, I should probably have said - GTK 2. Did that and it works like a charm. Now, the next bit. I want to mask out the window so that all that's visible is what I've drawn. I've done this using a "Full Wheelbarrow" example but that one uses pixmaps, not pixbufs. I found something somewhere which made me think the following would work, but it doesn't, any suggestions? GdkBitmap *mask = g_malloc( sizeof( GdkBitmap ) ); ... gdk_pixbuf_render_threshold_alpha( window->buffer, mask, 0, 0, 0, 0, width, height, 1 ); It's segfaulting when it runs that function. It could well be something silly I've done, it's been a long day :-/ Thanks, John ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
gtk problem with glarea
I have following problem: I use glarea to draw some 3D scene. I use toolbar with buttons to draw the objects. But when I click the button there is no refreshing on the window. When there is some acton over my window the object is displayed ( when i resize, use menus etc.) How should I refresh window? __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
copy somthing to the clipboard
Hey everyone, what is the function to copy somthing to the clipboard? I have a "edit" menu with the copy/paste/select all options but I don't know how to access the clipboard. I hope this is clear... heh thanks, Ben _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: glib-2.2.1: g_print() with UTF-8 characters
Hi, > > > - Glibc has a "feature" where %Ns actually checks for a whole > > >number of characters in the current encoding. So, unless you > > >are sure you are always going to be in an UTF-8 locale, avoid > > >using %Ns. (You are basically OK for iso-8859-1, but will > > >have problems in say, a Japanese locale.) > > > > It would make sense for g_print() to interpret %Ns correcly since it > > assumes that the strings passed to it always are encoded in UTF-8. If > > I could tell glibc that all strings passed to it will be encoded in > > UTF-8 no matter what the current locale is, then that would solve my > > problems. > > the point is that the string passed from g_print() to glibc is not > necessarily in UTF-8 encoding since g_print() does character set > conversion to the charset specified by the locale. The first call to glibc from g_print() is through vasprintf() and at that point the string is not yet converted from UTF-8 to the locale charset. This is also where the %Ns is interpreted. Before the string is actually printed with fputs, it is converted to the current locale charset however. If I understand things correctly, since glibc checks for the number of characters in current locale charset, converting the string to the locale charset before calling vasprintf would make g_print() work better. Ulf ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Deprecation of gtk_progress_bar_set_bar_style()
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 - --- Owen Taylor <[EMAIL PROTECTED]> wrote: > On Tue, 2003-03-04 at 03:13, Tommy McDaniel wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > I'm trying to learn GTK at present (I'm currently > > reading the API Reference word for word; I > probably > > won't remember squat when I'm done, but at least > I'll > > have an idea of what can be done and where to look > to > > remember how to do it), and the > > gtk_progress_bar_set_bar_style() function is said > to > > be deprecated. I've searched through the GTK > mailing > > lists trying to find anything about that function, > but > > I couldn't find anything. Why is this function > > deprecated? Is there another, presumably better > way to > > set whether the bar is discrete or continuous, or > was > > that deemed by someone to be a stupid feature? > That > > seems like a feature I myself would like. > > Allowing to to be app-settable was deemed to be a > stupid > feature. > > Why should some apps have progress bars that show > discrete > blocks, and other apps have progress bars that are > continuous? The same question applies to just about everything about GTK that doesn't have to always be one way and one way only in every application whatsoever that just happens to use GTK for its graphics. Take colors for instance. Why should some applications be predominantly gray while others are predominantly, say, hot pink? For just about any feature of GTK where the application developer can make a choice, the same question can be asked: why allow applications to use these different options, when all applications should be the same with regard to the setting? I myself don't really care whether progress bars are continuous or discrete in the programs that I use, even if they just happen to use the same graphical toolkit. I don't think it is really the role of the toolkit to limit the application developer's options; I can see something like GNOME making sure all its associated applications have a certain kind of scrollbar, since a common look and feel is desirable at that level, but GTK isn't GNOME, it is simply a graphical toolkit that can be used for an infinite number of things. GTK doesn't seem like the proper level at which to enforce a common theme. Why not even give the application developer the option? Is the 'wrong' style of progress bar worse than a predominantly neon pink and glowing green application, or one with any number of other annoying or downright retarded properties? I'm of the belief that, in general, the more freedom the programmer has, the better. There are clearly worse things one can do, and which GTK allows, than have the wrong style of progress bar. Tommy McDaniel -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+ZnyNVB8FYP9YqDcRAqTyAJ4m2ma7CWvvjNlsxhpA3bF2/Wco0wCfagEO w87650J7qWl9eRefUYJ/AwM= =EWBg -END PGP SIGNATURE- __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Deprecation of gtk_progress_bar_set_bar_style()
On Wed, 2003-03-05 at 17:42, Tommy McDaniel wrote: > > > I couldn't find anything. Why is this function > > > deprecated? Is there another, presumably better > > way to > > > set whether the bar is discrete or continuous, or > > was > > > that deemed by someone to be a stupid feature? > > That > > > seems like a feature I myself would like. > > > > Allowing to to be app-settable was deemed to be a > > stupid > > feature. > > > > Why should some apps have progress bars that show > > discrete > > blocks, and other apps have progress bars that are > > continuous? > [...] > Why not even give the application > developer the option? Is the 'wrong' style of progress > bar worse than a predominantly neon pink and glowing > green application, or one with any number of other > annoying or downright retarded properties? I'm of the > belief that, in general, the more freedom the > programmer has, the better. There are clearly worse > things one can do, and which GTK allows, than have the > wrong style of progress bar. Actually, while we do have gtk_widget_modify_fg/bg, it's pretty hard to make *all* your widgets hot pink and glowing green without writing a GTK+ theme. Generally, by giving flexibility to the application programmer, you are taking it away from the theme writer and thus desktop environment and you are taking it away from the user. Roughly speaking: - If some UI aspect would make sense to do in one application and not in another, it should be an application setting. - If an option would make sense for some themes, and not others, we make it a "style property" an option that is set in a theme RC file. - If an option would make sense for some users and not others, we making it a GtkSetting configuration option. Letting apps set things that should be theme or user settings just means that the users get the imposed preferences of each app author and get inconsistency, rather than getting a consistent set of preferences that _they_ want. I don't think we made discrete vs. continuous setting a style property ... partly because we had to still support the deprecated function. But that's clearly if it is an option, it should be a style property, not something applications set. Regards, Owen ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
properties for GtkCellRenderText -- Whoohoo it works!
This message ties into an earlier message where I stated I would try out some code to see if I could change the attributes of text in my GtkListStore. It works quite nicely. Here's what happens: 1) user selects an item in my GtkTreeView (note: in this case just a single column view). 2) User clicks a button and the text at that selection turns red! Here's what I did: 1) I have an enumerated type for the storage model enum { DATA_COLUMN, MODEL_ATTRIBUTES, N_COLUMNS } 2) Created a callback for the the button press: void on_button_clicked (GtkButton *button, gpointer *userData) { do_color_test(gtk_widget_get_toplevel(button)); } 3) now, in the do_color_test routine, I need to do several things: - get the view - get the model - get the current selection - return the proper iter for the selection - set the attribute to "red" for the current selection void do_color_test (GtkWidget *theWindow) { GtkWidget *theView = NULL; GtkListStore *theListStore = NULL; GtkTreeIter theIter; GtkTreeModel *theModel = NULL; GtkTreeSelection *currentSelection; theView = lookup_widget(theWindow, "atreeview"); theModel = gtk_tree_view_get_model(theView); if (GTK_IS_LIST_STORE (theModel)) { theListStore = GTK_LIST_STORE (theModel); g_print("theModel is a ListStore\n"); } /* get the current selection from theView */ currentSelection = gtk_tree_view_get_selection(theView); /* now that we have a selection, get the exact location in theIter */ if (!gtk_tree_selection_get_selected(currentSelection, &theListStore, &theIter)) { g_print("no current selection!!\n"); } /* set the color for that row to red */ gtk_list_store_set(theListStore, &theIter, MODEL_ATTRIBUTES, "red", -1); } There are probably more efficient methods of doing this. For example, do I need to call gtk_tree_view_get_selection at all? Some obvious debug code can also be elminated but that's the jist of it. -- .''`. Carl B. Constantine : :' : [EMAIL PROTECTED] `. `'GnuPG: 135F FC30 7A02 B0EB 61DB 34E3 3AF1 DC6C 9F7A 3FF8 `- Debian GNU/Linux -- The power of freedom pgp0.pgp Description: PGP signature
Re: Taking control of a remote program
On Wed, 05 Mar 2003 16:16:15 + Diego Zuccato <[EMAIL PROTECTED]> wrote: > Hello. > > Maybe it's a bit offtopic, but I'm interested just in the Gtk case... > I'd need to take control of a RUNNING app from another machine. > For example, when my mother "locks" my program, I'd like to ssh to > that machine (already possible) and then "mirror" on my machine what > she sees, so to "unlock" it in a couple of clicks instead of having to > phisically go to that machine for the same two clicks... > > I think it's possible with VNC, but since it's lot of overhead I'd > like to know if there's some other way ... > > BYtE, > Diego. There is TightVNC, which is a little better/faster. You can also just connect to her X server. Export your DISPLAY to point to her: export DISPLAY=mymoms-ip:0 Jim Drabb -- --- Those who would sacrifice freedom for security will get neither --- James Drabb JR Programmer Analyst Davenport, FL JDrabb at tampabay dot rr dot com ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk problem with glarea
On Wed, 2003-03-05 at 22:52, Stoyan karanfilov wrote: > I have following problem: > I use glarea to draw some 3D scene. I use toolbar with > buttons to draw the objects. But when I click the > button there is no refreshing on the window. When > there is some acton over my window the object is > displayed ( when i resize, use menus etc.) How should > I refresh window? You should have a look at gtkglarea examples. The function to use is gtk_widget_draw. -- Xavier Ordoquy <[EMAIL PROTECTED]> Gnome ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
GtkOptionMenu
I'm trying to use a GtkOptionMenu, but I can't figure out how to retrieve the selected text. I can retrieve the MenuItem but not any text associated with it. I was using a combo box but I read that if I don't want to edit the text, it is better to use an option menu. This seems like it should be very basic, but the API doesn't help any. Audrey