Re: optimal way to use Memory Chunks
Olivier Sessink wrote: Gus Koppel wrote: What sort of 4 byte information is to be stored, if I may ask? Is it to be referenced mainly by entry numbers (1st, 2nd, 3rd, ... atom) or by contents, i.e. locating atoms that contain particular values? Possibly for your app GMemChunks are not only inefficient but unsuitable at all. so not 4 bytes, but anyway, what they are: they are changes in an editor(Bluefish), to be used by the 'undo' function. Each struct has a pointer with a buffer holding the change, a start and end position, and a state'insert' or 'delete'. As you can imagine, with 20 documents open, and doing heavy editing, the number of instances may go up to 5000. They can be freed whenever some document is closed, so the G_ALLOC_AND_FREE mode may be more appropriate. I could associate a GMemChunk to each document so I can use G_ALLOC_ONLY, but people often open many documents (100+), and edit only a few of them. Having a GMemChunk prepared for each document would then be quite some overload.. If it's not treated in a rather special way I suppose your Undo history to be just a LiFo stack with elements of identical size. For this I would simply use dynamically allocated arrays of your Undo step objects, one array per document, indeed. GLib provides GArrays for this purpose, but I wouldn't use them either. The simpliest way is to define (and unconditionally allocate) a fixed maximum number of elements, i.e. 5000, per document. The smarter way is to provide three functions (due to simplicity could even be macros) like undo_stack_push(), undo_stack_pop() and undo_stack_moveto(). undo_stack_push() would add one element to the stack and resize (enlarge) the stack by a fixed number of elements, i.e. 256, if necessary. undo_stack_moveto() would move the stack pointer to any already allocated element within the stack. undo_stack_pop() would simply invoke undo_stack_moveto() to move the stack pointer one element back. An optional undo_stack_cleanup(), to be invoked occasionally, could shrink or deallocate the stack space if there are far less elements in the stack than it has capacity for. My point is: for a LiFo stack of equally sixed elements GMemChunk isn't an appropriate feature. If at all, then GArray would better serve this purpose. But I would consider even that one overhead. Those simple three or four custom functions described above would do the job better, more efficiently and without any overhead of GMemChunk or GArray. You would always have to invest some extra typing to put a GArray into the context of your program, your objects, etc. This could be saved by a direct, custom implementation. In general, I think GLib features should not be utilized by all means. If a custom implementation is that easy (like this one appears to be) and likely more efficient, then you shouldn't use toolkit functions just because they are there and could solve the problem as well. Too much ardour for that might let some people end up one terrible day by writing x = g_math_add (g_math_sub (a, g_math_mul (b, c)), d); instead of just x = a - b * c + d; ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: optimal way to use Memory Chunks
Gus Koppel wrote: Too much ardour for that might let some people end up one terrible day by writing x = g_math_add (g_math_sub (a, g_math_mul (b, c)), d); instead of just x = a - b * c + d; You mean of course g_math_assign(x, g_math_add (g_math_sub (a, g_math_mul (b, c)), d)); Stefan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Gtk terminal widget
Hi all i need to deveop a Gtk app that shows up a shell terminal. I know two GtkWidgets do exists: ZVT http://developer.gnome.org/doc/API/zvtterm/zvtterm.html VTE http://developer.gnome.org/doc/API/2.0/vte/index.html The app will run over DirectFrameBuffer and not X and has to be as small as possible (we cannot use gnome-libs for space reasons). Is this possible to do? what's the best choice if both terminals are suitable for such a purpose? thank you very much Attilio ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Warning with GTK 2.6. 8 Could not find the icon 'gnome-fs-home'
On Wed, 2005-11-09 at 07:39 -0800, Colossus wrote: Allin Cottrell wrote: Yes, I have seen exactly this problem. Suprisingly enough, I solved it by doing exactly what was suggested, namely installing the hicolor icon them from the URL given. Suprisingly enough why don't remove this dependancy ? Not everyone uses GNOME or KDE. It is easy to use hicolor without using GNOME or KDE. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Warning with GTK 2.6. 8 Could not find the icon 'gnome-fs-home'
On Wed, Nov 09, 2005 at 08:28:15AM -0500, Matthias Clasen wrote: It is easy to use hicolor without using GNOME or KDE. IMHO the question is why it has to print such a warning at all, not what people can or cannot use hicolor with. Yeti -- That's enough. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Problem sending data to gtk_button on clicked event
I've been getting seg-faults when I try to work with data in my button clicked callback functions, so as a test, I compiled and ran the following program: #include gtk/gtk.h gchar m1[] = button 1; gchar m2[] = button 2; static void callback(GtkWidget* widget, GdkEvent *event, gpointer data) { g_print (Hello again - %08X was pressed\n, data); } static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data) { g_print (Check it - %08X was pressed\n, data); gtk_main_quit(); return TRUE; } int main(int argc, char* argv[]) { GtkWidget *window; GtkWidget *button; GtkWidget *box1; printf(m1: %08X\n,m1); printf(m2: %08X\n,m2); printf((gpointer)m1: %08X\n,(gpointer)m1); printf((gpointer)m2: %08X\n,(gpointer)m2); gtk_init(argc,argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window),delete_event,G_CALLBACK(delete_event),(gpointer)m1); box1 = gtk_hbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(window),box1); button = gtk_button_new_with_label(Button 1); g_signal_connect(G_OBJECT(button),clicked,G_CALLBACK(callback),(gpointer)m1); gtk_box_pack_start(GTK_BOX(box1),button,TRUE,TRUE,0); gtk_widget_show(button); button = gtk_button_new_with_label(Button 2); g_signal_connect(G_OBJECT(button),clicked,G_CALLBACK(callback),(gpointer)m2); gtk_box_pack_start(GTK_BOX(box1),button,TRUE,TRUE,0); gtk_widget_show(button); gtk_widget_show(box1); gtk_widget_show(window); gtk_main(); return 0; } I ran this program, and clicked on Button 1, then Button 2, and then the close button. My program output was: m1: 080491EC m2: 080491F5 (gpointer)m1: 080491EC (gpointer)m2: 080491F5 Hello again - 0002 was pressed Hello again - 0002 was pressed Check it - 080491EC was pressed Naturally, if I use %s to try and output the data from the button callback functions, it seg faults. What am I doing wrong? Is there something else I need to do to be able to send data on a clicked event? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GTK + Xine
Hi, What kind of widget sould i include in my GTK Glade designed application in order to include a libxine based video viewer window ? Are there some basic examples or docs about that ? thanks for help, Chris ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem sending data to gtk_button on clicked event
On Wed, 2005-11-09 at 08:39, Evan Behar wrote: I've been getting seg-faults when I try to work with data in my button clicked callback functions, so as a test, I compiled and ran the following program: #include gtk/gtk.h gchar m1[] = button 1; gchar m2[] = button 2; static void callback(GtkWidget* widget, GdkEvent *event, gpointer data) { g_print (Hello again - %08X was pressed\n, data); } Your problem is that the marshaller for button clicked events only passes two parameters. Try: static void callback(GtkWidget *widget, gpointer data); static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data) { g_print (Check it - %08X was pressed\n, data); gtk_main_quit(); return TRUE; } int main(int argc, char* argv[]) { GtkWidget *window; GtkWidget *button; GtkWidget *box1; printf(m1: %08X\n,m1); printf(m2: %08X\n,m2); printf((gpointer)m1: %08X\n,(gpointer)m1); printf((gpointer)m2: %08X\n,(gpointer)m2); gtk_init(argc,argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window),delete_event,G_CALLBACK(delete_event),(gpointer)m1); box1 = gtk_hbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(window),box1); button = gtk_button_new_with_label(Button 1); g_signal_connect(G_OBJECT(button),clicked,G_CALLBACK(callback),(gpointer)m1); gtk_box_pack_start(GTK_BOX(box1),button,TRUE,TRUE,0); gtk_widget_show(button); button = gtk_button_new_with_label(Button 2); g_signal_connect(G_OBJECT(button),clicked,G_CALLBACK(callback),(gpointer)m2); gtk_box_pack_start(GTK_BOX(box1),button,TRUE,TRUE,0); gtk_widget_show(button); gtk_widget_show(box1); gtk_widget_show(window); gtk_main(); return 0; } I ran this program, and clicked on Button 1, then Button 2, and then the close button. My program output was: m1: 080491EC m2: 080491F5 (gpointer)m1: 080491EC (gpointer)m2: 080491F5 Hello again - 0002 was pressed Hello again - 0002 was pressed Check it - 080491EC was pressed Naturally, if I use %s to try and output the data from the button callback functions, it seg faults. What am I doing wrong? Is there something else I need to do to be able to send data on a clicked event? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Alan M. Evans [EMAIL PROTECTED] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem sending data to gtk_button on clicked event
Evan Behar wrote: I've been getting seg-faults when I try to work with data in my button clicked callback functions, so as a test, I compiled and ran the following program: #include gtk/gtk.h gchar m1[] = button 1; gchar m2[] = button 2; static void callback(GtkWidget* widget, GdkEvent *event, gpointer data) { g_print (Hello again - %08X was pressed\n, data); } I'm not 100% sure, but I think this is not the proper callback for a clicked event. I think the documentation has static void callback(GtkWidget* widget, gpointer data); as the prototype. regards, Olivier ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem sending data to gtk_button on clicked event
Evan Behar wrote: I've been getting seg-faults when I try to work with data in my button clicked callback functions, so as a test, I compiled and ran the following program: Be carefull how you prototype your callbacks, for example; the GtkButtonClass's closure for the clicked signal will expect a function of type `void callback (GObject *, gpointer)' I'm not sure what the expected signature is for the delete_event though. Cheers, -Tristan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
disabling notebook shortcuts
Hi, Is there a clean way to disable GtkNotebook keyboard shortcuts? For instance, if I use a notebook widget (with tabs hidden, obviously) for a wizard dialog, I don't want the user to break the thing down by pressing Ctrl-PgDown and force a tab switch without the program's consent. Paul ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkStatusIcon
Hi, I'm about to write an App using GTK+. I'm trying to get a Status Icon in Yellow. --snip-- GdkPixbuf* YI = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 24, 24); GdkColor color; guint32 pixel; if (gdk_color_parse (Yellow, color)) pixel = (color.red8) 24 | (color.green 8) 16 | (color.blue 8) 8; gdk_pixbuf_fill (YI, pixel); GtkStatusIcon* YellowIcon=gtk_status_icon_new_from_pixbuf(YI); --snap-- OK. Should be correct, but I get Errors while I compile: --snip-- main.c: In function `main': main.c:106: error: `GtkStatusIcon' undeclared (first use in this function) main.c:106: error: (Each undeclared identifier is reported only once main.c:106: error: for each function it appears in.) main.c:106: error: `YellowIcon' undeclared (first use in this function) make: *** [main.o] Error 1 --snap-- When I replace GtkStatusIcon with GtkWidget I get --snip-- main.c: In function `main': main.c:106: warning: initialization makes pointer from integer without a cast (...) main.o:main.c:(.text+0x881): undefined reference to `gtk_status_icon_new_from_pixbuf' --snap-- So, where it is? I've included gtk/gtk.h. and as libs I've -lcairo -lpangox11-1.0 -latk-1.0 -lgdk_pixbuf-2.0 -lgdk-x11-2.0 -lglib-2.0.dll -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lgtk-x11-2.0 -lpango-1.0 Thanks in Advance, G.M. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkStatusIcon
On Wed, 2005-11-09 at 19:08 +0100, Giuliano Montecarlo wrote: Hi, I'm about to write an App using GTK+. I'm trying to get a Status Icon in Yellow. --snip-- GdkPixbuf* YI = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 24, 24); GdkColor color; guint32 pixel; if (gdk_color_parse (Yellow, color)) pixel = (color.red8) 24 | (color.green 8) 16 | (color.blue 8) 8; gdk_pixbuf_fill (YI, pixel); GtkStatusIcon* YellowIcon=gtk_status_icon_new_from_pixbuf(YI); --snap-- OK. Should be correct, but I get Errors while I compile: --snip-- main.c: In function `main': main.c:106: error: `GtkStatusIcon' undeclared (first use in this function) main.c:106: error: (Each undeclared identifier is reported only once main.c:106: error: for each function it appears in.) main.c:106: error: `YellowIcon' undeclared (first use in this function) make: *** [main.o] Error 1 --snap-- When I replace GtkStatusIcon with GtkWidget I get --snip-- main.c: In function `main': main.c:106: warning: initialization makes pointer from integer without a cast (...) main.o:main.c:(.text+0x881): undefined reference to `gtk_status_icon_new_from_pixbuf' --snap-- So, where it is? I've included gtk/gtk.h. and as libs I've -lcairo -lpangox11-1.0 -latk-1.0 -lgdk_pixbuf-2.0 -lgdk-x11-2.0 -lglib-2.0.dll -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lgtk-x11-2.0 -lpango-1.0 GtkStatusIcon is new api that is not in any stable gtk release yet. It will appear in gtk 2.10. Matthias ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Warning with GTK 2.6. 8 Could not find the icon 'gnome-fs-home'
Thanks for the info. I had installed GTK the theme in /opt/gtk . But GTK was looking for the theme in /usr/local/share. Setting XDG_DATA_DIRS to the /opt/gtk/share directory solved the problem. On 11/8/05, Allin Cottrell [EMAIL PROTECTED] wrote: On Tue, 8 Nov 2005, Gowri Kandasamy wrote: I am using GTK 2.6.8 . When I run my application with this GTK , I get the following warning message. I get this when I try to open the file chooser window. (firefox-bin:6267): Gtk-WARNING **: Could not find the icon 'gnome-fs-home'. The 'hicolor' theme was not found either, perhaps you need to install it. You can get a copy from: http://freedesktop.org/Software/icon-theme/releases Has anyone seen this problem? Yes, I have seen exactly this problem. Suprisingly enough, I solved it by doing exactly what was suggested, namely installing the hicolor icon them from the URL given. However, the URL has changed. It's now http://icon-theme.freedesktop.org/wiki/HicolorTheme (URLS at freedesktop.org http://freedesktop.org can't be expected to remain stable for more than a few weeks at a time, for some reason.) Allin Cottrell ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Signal for a button-2 paste event in a TextView
I have a GtkTextView with an associated GtkTextBuffer. I want to act on the condition when text is pasted into the textview or textbuffer when the middle mouse button is pressed. That is, suppose I have some text selected in another application (like a gnome-terminal, evolution, etc.) or when I have some text selected within the same textview. When I move the mouse to a position and press the middle mouse button, the selected text is inserted at the point click. However, I want to add the text myself with certain modifications. I am attempting to find the appropriate signal to use. I have tried, selection-get selection- notify-event selection-received selection-request-event and paste_clipboard. None of these result in my callback being called. (The paste_clipboard only seems to be called when I do a ctrl-c ctrl-v combination.) I've just been guessing with these signals since the API docs offer no explanation on what they represent. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Changing fontsize of a label
Hi, how can I change the fontsize of a label? And how can I make it bold? MfG GAM ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Changing fontsize of a label
Giuliano Montecarlo wrote: Hi, how can I change the fontsize of a label? And how can I make it bold? You can do it in several ways, one of the easiest is to use special markup language: http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html There's a function you have to use to apply markup to label: http://developer.gnome.org/doc/API/2.0/gtk/GtkLabel.html#gtk-label-set-markup Olexiy ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list